Skip to content

Commit

Permalink
Ignore v8 coverage for not testable codes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Feb 19, 2023
1 parent 76c0cba commit 55bede2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class ResolvedEngine {
}

// NOTE: It cannot test because of overriding `require` in Jest context.
/* c8 ignore next */
private findClassPath(klass) {
for (const moduleId in require.cache) {
const expt = require.cache[moduleId]?.exports
Expand Down
4 changes: 2 additions & 2 deletions src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve
return await page.close()
} catch (e: any) {
// Ignore raising error if a target page has already close
/* istanbul ignore next */
/* c8 ignore next */
if (!e.message.includes('Target closed.')) throw e
}
},
Expand Down Expand Up @@ -183,7 +183,7 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve

let windowObject: Preview.Window | undefined

/* istanbul ignore next */
/* c8 ignore next */
if (process.platform === 'darwin') {
// An initial app window is not using in macOS for correct handling activation from Dock
windowObject = (await this.createWindow()) || undefined
Expand Down
2 changes: 1 addition & 1 deletion src/templates/bespoke/utils/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const _testElementAnimation = (
elm: HTMLElement,
callback: (ret: MarpTransitionResolvableKeyframeSettings | undefined) => void
) => {
/* istanbul ignore next */
/* c8 ignore next */
requestAnimationFrame(() => {
elm.style.animationPlayState = 'running'
requestAnimationFrame(() => callback(undefined))
Expand Down
5 changes: 3 additions & 2 deletions src/utils/chrome-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ export const findChromeInstallation = async () => {
return linux()
case 'win32':
return win32()
/* istanbul ignore next: CI cannot test against WSL environment */
// CI cannot test against WSL environment
/* c8 ignore next */
case 'wsl':
return wsl()
}
/* istanbul ignore next */
/* c8 ignore next */
return []
})()

Expand Down

0 comments on commit 55bede2

Please sign in to comment.