Skip to content

Commit

Permalink
refactor: move coverage.ts to coverage/c8.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jul 21, 2022
1 parent 5d16183 commit 1ef1b98
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ node_modules
*.snap
*.d.ts
coverage
!**/integrations/coverage
!.vitepress
test/core/src/self
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ yarn-debug.log*
yarn-error.log*
lib-cov
coverage
!**/integrations/coverage
node_modules
.env
.cache
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-node/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class ViteNodeRunner {
// Be careful when changing this
// changing context will change amount of code added on line :114 (vm.runInThisContext)
// this messes up sourcemaps for coverage
// adjust `offset` variable in packages/vitest/src/integrations/coverage.ts#L100 if you do change this
// adjust `offset` variable in packages/vitest/src/integrations/coverage/c8.ts#L100 if you do change this
const context = this.prepareContext({
// esm transformed by Vite
__vite_ssr_import__: request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import _url from 'url'
import type { Profiler } from 'inspector'
import { resolve } from 'pathe'
import type { RawSourceMap } from 'vite-node'
import type { Vitest } from '../node'
import { toArray } from '../utils'
import type { C8Options, ResolvedC8Options } from '../types'
import { configDefaults } from '../defaults'
import type { Vitest } from '../../node'
import { toArray } from '../../utils'
import type { C8Options, ResolvedC8Options } from '../../types'
import { configDefaults } from '../../defaults'

export function resolveC8Options(options: C8Options, root: string): ResolvedC8Options {
const resolved: ResolvedC8Options = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ResolvedConfig as ResolvedViteConfig } from 'vite'
import type { ApiConfig, ResolvedConfig, UserConfig } from '../types'
import { defaultPort } from '../constants'
import { configDefaults } from '../defaults'
import { resolveC8Options } from '../integrations/coverage'
import { resolveC8Options } from '../integrations/coverage/c8'
import { toArray } from '../utils'
import { VitestCache } from './cache'
import { BaseSequencer } from './sequencers/BaseSequencer'
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ViteNodeServer } from 'vite-node/server'
import type { ArgumentsType, Reporter, ResolvedConfig, UserConfig } from '../types'
import { SnapshotManager } from '../integrations/snapshot/manager'
import { clearTimeout, deepMerge, hasFailed, noop, setTimeout, slash } from '../utils'
import { cleanCoverage, reportCoverage } from '../integrations/coverage'
import { cleanCoverage, reportCoverage } from '../integrations/coverage/c8'
import { createPool } from './pool'
import type { WorkerPool } from './pool'
import { createReporters } from './reporters/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/runtime/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import limit from 'p-limit'
import type { File, HookCleanupCallback, HookListener, ResolvedConfig, Suite, SuiteHooks, Task, TaskResult, TaskState, Test } from '../types'
import { vi } from '../integrations/vi'
import { clearTimeout, getFullName, getWorkerState, hasFailed, hasTests, isBrowser, isNode, partitionSuiteChildren, setTimeout, shuffle } from '../utils'
import { takeCoverage } from '../integrations/coverage'
import { takeCoverage } from '../integrations/coverage/c8'
import { getState, setState } from '../integrations/chai/jest-expect'
import { GLOBAL_EXPECT } from '../integrations/chai/constants'
import { getFn, getHooks } from './map'
Expand Down

0 comments on commit 1ef1b98

Please sign in to comment.