Skip to content

Commit

Permalink
test: fix browser coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Mar 25, 2024
1 parent fee7d8b commit be531e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/coverage-test/test/coverage.test.ts
Expand Up @@ -14,7 +14,8 @@ import virtualFile2 from '\0vitest-custom-virtual-file-2'

// Browser mode crashes with dynamic files. Enable this when browser mode works.
// To keep istanbul report consistent between browser and node, skip dynamic tests when istanbul is used.
const skipDynamicFiles = '__vitest_browser__' in globalThis || globalThis.process?.env.COVERAGE_PROVIDER === 'istanbul' || !globalThis.process?.env.COVERAGE_PROVIDER
const provider = globalThis.process?.env.COVERAGE_PROVIDER
const skipDynamicFiles = '__vitest_browser__' in globalThis || provider === 'istanbul' || !provider

const { pythagoras } = await (() => {
if ('__vitest_browser__' in globalThis)
Expand Down Expand Up @@ -78,7 +79,7 @@ test('decorators', () => {
})

// Istanbul fails to follow source maps on windows
test.skipIf(globalThis.process?.env.COVERAGE_PROVIDER === 'istanbul')('pre-transpiled code with source maps to original', async () => {
test.runIf(provider === 'v8' || provider === 'custom')('pre-transpiled code with source maps to original', async () => {
const transpiled = await import('../src/transpiled.js')

transpiled.hello()
Expand Down

0 comments on commit be531e7

Please sign in to comment.