diff --git a/bench/pnpm-lock.yaml b/bench/pnpm-lock.yaml index 7ef487621cce..ad19fc38a9b8 100644 --- a/bench/pnpm-lock.yaml +++ b/bench/pnpm-lock.yaml @@ -109,34 +109,6 @@ importers: specifier: workspace:* version: link:../vitest - ../packages/coverage-c8: - dependencies: - '@ampproject/remapping': - specifier: ^2.2.1 - version: 2.2.1 - c8: - specifier: ^7.14.0 - version: 7.14.0 - magic-string: - specifier: ^0.30.1 - version: 0.30.1 - picocolors: - specifier: ^1.0.0 - version: 1.0.0 - std-env: - specifier: ^3.3.3 - version: 3.3.3 - devDependencies: - pathe: - specifier: ^1.1.1 - version: 1.1.1 - vite-node: - specifier: workspace:* - version: link:../vite-node - vitest: - specifier: workspace:* - version: link:../vitest - ../packages/coverage-istanbul: dependencies: istanbul-lib-coverage: @@ -6000,25 +5972,6 @@ packages: ieee754: 1.2.1 dev: true - /c8@7.14.0: - resolution: {integrity: sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==} - engines: {node: '>=10.12.0'} - hasBin: true - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@istanbuljs/schema': 0.1.3 - find-up: 5.0.0 - foreground-child: 2.0.0 - istanbul-lib-coverage: 3.2.0 - istanbul-lib-report: 3.0.0 - istanbul-reports: 3.1.5 - rimraf: 3.0.2 - test-exclude: 6.0.0 - v8-to-istanbul: 9.1.0 - yargs: 16.2.0 - yargs-parser: 20.2.9 - dev: false - /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -7640,14 +7593,6 @@ packages: is-callable: 1.2.4 dev: true - /foreground-child@2.0.0: - resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} - engines: {node: '>=8.0.0'} - dependencies: - cross-spawn: 7.0.3 - signal-exit: 3.0.7 - dev: false - /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 59c1e53d6f1f..28e6fc6b03f8 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -37,7 +37,7 @@ export default withPwa(defineConfig({ ['link', { rel: 'icon', href: '/favicon.ico', sizes: 'any' }], ['link', { rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }], ['meta', { name: 'author', content: `${teamMembers.map(c => c.name).join(', ')} and ${vitestName} contributors` }], - ['meta', { name: 'keywords', content: 'vitest, vite, test, coverage, snapshot, react, vue, preact, svelte, solid, lit, ruby, cypress, puppeteer, jsdom, happy-dom, test-runner, jest, typescript, esm, tinypool, tinyspy, c8, node' }], + ['meta', { name: 'keywords', content: 'vitest, vite, test, coverage, snapshot, react, vue, preact, svelte, solid, lit, ruby, cypress, puppeteer, jsdom, happy-dom, test-runner, jest, typescript, esm, tinypool, tinyspy, node' }], ['meta', { property: 'og:title', content: vitestName }], ['meta', { property: 'og:description', content: vitestDescription }], ['meta', { property: 'og:url', content: ogUrl }], diff --git a/docs/config/index.md b/docs/config/index.md index 78c69daf8e8a..30e83dacbc33 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -667,10 +667,6 @@ Isolate environment for each test file. Does not work if you disable [`--threads You can use [`v8`](https://v8.dev/blog/javascript-code-coverage), [`istanbul`](https://istanbul.js.org/) or [a custom coverage solution](/guide/coverage#custom-coverage-provider) for coverage collection. -::: info -The `c8` provider is being replaced by the `v8` provider. It will be deprecated in the next major version. -::: - You can provide coverage options to CLI with dot notation: ```sh @@ -683,7 +679,7 @@ If you are using coverage options with dot notation, don't forget to specify `-- #### coverage.provider -- **Type:** `'c8' | 'v8' | 'istanbul' | 'custom'` +- **Type:** `'v8' | 'istanbul' | 'custom'` - **Default:** `'v8'` - **CLI:** `--coverage.provider=` @@ -693,7 +689,7 @@ Use `provider` to select the tool for coverage collection. - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.enabled`, `--coverage.enabled=false` Enables coverage collection. Can be overridden using `--coverage` CLI option. @@ -702,7 +698,7 @@ Enables coverage collection. Can be overridden using `--coverage` CLI option. - **Type:** `string[]` - **Default:** `['**']` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.include=`, `--coverage.include= --coverage.include=` List of files included in coverage as glob patterns @@ -711,7 +707,7 @@ List of files included in coverage as glob patterns - **Type:** `string | string[]` - **Default:** `['.js', '.cjs', '.mjs', '.ts', '.mts', '.cts', '.tsx', '.jsx', '.vue', '.svelte']` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.extension=`, `--coverage.extension= --coverage.extension=` #### coverage.exclude @@ -733,7 +729,7 @@ List of files included in coverage as glob patterns '**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}', ] ``` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.exclude=`, `--coverage.exclude= --coverage.exclude=` List of files excluded from coverage as glob patterns. @@ -742,7 +738,7 @@ List of files excluded from coverage as glob patterns. - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.all`, `--coverage.all=false` Whether to include all files, including the untested ones into report. @@ -751,7 +747,7 @@ Whether to include all files, including the untested ones into report. - **Type:** `boolean` - **Default:** `true` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.clean`, `--coverage.clean=false` Clean coverage results before running tests @@ -760,7 +756,7 @@ Clean coverage results before running tests - **Type:** `boolean` - **Default:** `true` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.cleanOnRerun`, `--coverage.cleanOnRerun=false` Clean coverage report on watch rerun @@ -769,7 +765,7 @@ Clean coverage report on watch rerun - **Type:** `string` - **Default:** `'./coverage'` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.reportsDirectory=` Directory to write coverage report to. @@ -778,7 +774,7 @@ Directory to write coverage report to. - **Type:** `string | string[] | [string, {}][]` - **Default:** `['text', 'html', 'clover', 'json']` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.reporter=`, `--coverage.reporter= --coverage.reporter=` Coverage reporters to use. See [istanbul documentation](https://istanbul.js.org/docs/advanced/alternative-reporters/) for detailed list of all reporters. See [`@types/istanbul-reporter`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/276d95e4304b3670eaf6e8e5a7ea9e265a14e338/types/istanbul-reports/index.d.ts) for details about reporter specific options. @@ -805,7 +801,7 @@ Since Vitest 0.31.0, you can check your coverage report in Vitest UI: check [Vit - **Type:** `boolean` - **Default:** `false` (since Vitest `0.34.0`) -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.reportOnFailure`, `--coverage.reportOnFailure=false` - **Version:** Since Vitest 0.31.2 @@ -815,7 +811,7 @@ Generate coverage report even when tests fail. - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.skipFull`, `--coverage.skipFull=false` Do not show files with 100% statement, branch, and function coverage. @@ -824,7 +820,7 @@ Do not show files with 100% statement, branch, and function coverage. - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.perFile`, `--coverage.perFile=false` Check thresholds per file. @@ -834,7 +830,7 @@ See `lines`, `functions`, `branches` and `statements` for the actual thresholds. - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.thresholdAutoUpdate=` Update threshold values `lines`, `functions`, `branches` and `statements` to configuration file when current coverage is above the configured thresholds. @@ -843,7 +839,7 @@ This option helps to maintain thresholds when coverage is improved. #### coverage.lines - **Type:** `number` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.lines=` Threshold for lines. @@ -852,7 +848,7 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol #### coverage.functions - **Type:** `number` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.functions=` Threshold for functions. @@ -861,7 +857,7 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol #### coverage.branches - **Type:** `number` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.branches=` Threshold for branches. @@ -870,44 +866,17 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-threshol #### coverage.statements - **Type:** `number` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` - **CLI:** `--coverage.statements=` Threshold for statements. See [istanbul documentation](https://github.com/istanbuljs/nyc#coverage-thresholds) for more information. -#### coverage.allowExternal - -- **Type:** `boolean` -- **Default:** `false` -- **Available for providers:** `'c8'` -- **CLI:** `--coverage.allowExternal`, `--coverage.allowExternal=false` - -Allow files from outside of your cwd. - -#### coverage.excludeNodeModules - -- **Type:** `boolean` -- **Default:** `true` -- **Available for providers:** `'c8'` -- **CLI:** `--coverage.excludeNodeModules`, `--coverage.excludeNodeModules=false` - -Exclude coverage under `/node_modules/`. - -#### coverage.src - -- **Type:** `string[]` -- **Default:** `process.cwd()` -- **Available for providers:** `'c8'` -- **CLI:** `--coverage.src=` - -Specifies the directories that are used when `--all` is enabled. - #### coverage.100 - **Type:** `boolean` - **Default:** `false` -- **Available for providers:** `'c8' | 'v8'` +- **Available for providers:** `'v8'` - **CLI:** `--coverage.100`, `--coverage.100=false` Shortcut for `--check-coverage --lines 100 --functions 100 --branches 100 --statements 100`. @@ -946,7 +915,7 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#ignoring-methods) } ``` -- **Available for providers:** `'c8' | 'v8' | 'istanbul'` +- **Available for providers:** `'v8' | 'istanbul'` Watermarks for statements, lines, branches and functions. See [istanbul documentation](https://github.com/istanbuljs/nyc#high-and-low-watermarks) for more information. diff --git a/docs/guide/coverage.md b/docs/guide/coverage.md index 8bc72938723f..19ab602b4cb6 100644 --- a/docs/guide/coverage.md +++ b/docs/guide/coverage.md @@ -6,10 +6,6 @@ title: Coverage | Guide Vitest supports Native code coverage via [`v8`](https://v8.dev/blog/javascript-code-coverage) and instrumented code coverage via [`istanbul`](https://istanbul.js.org/). -:::info -The `c8` provider is being replaced by the [`v8`](https://v8.dev/blog/javascript-code-coverage) provider. It will be deprecated in the next major version. -::: - ## Coverage Providers :::tip diff --git a/examples/react-testing-lib/package.json b/examples/react-testing-lib/package.json index d7e8845ce824..b1a3b16a7e03 100644 --- a/examples/react-testing-lib/package.json +++ b/examples/react-testing-lib/package.json @@ -20,7 +20,7 @@ "@types/react": "^18.0.24", "@types/react-dom": "^18.0.8", "@vitejs/plugin-react": "latest", - "@vitest/coverage-c8": "^0.24.5", + "@vitest/coverage-v8": "latest", "@vitest/ui": "latest", "jsdom": "latest", "typescript": "^4.8.4", diff --git a/package.json b/package.json index 97c2b63bec22..3b9ee959ae95 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "@types/node": "^18.16.19", "@types/ws": "^8.5.5", "@vitest/browser": "workspace:*", - "@vitest/coverage-c8": "workspace:*", "@vitest/coverage-istanbul": "workspace:*", "@vitest/coverage-v8": "workspace:*", "@vitest/ui": "workspace:*", diff --git a/packages/coverage-c8/package.json b/packages/coverage-c8/package.json deleted file mode 100644 index d3b587597908..000000000000 --- a/packages/coverage-c8/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@vitest/coverage-c8", - "type": "module", - "version": "0.33.0", - "description": "C8 coverage provider for Vitest", - "author": "Anthony Fu ", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/coverage-c8#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/coverage-c8" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "keywords": [ - "vite", - "vitest", - "test", - "coverage", - "c8" - ], - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "rimraf dist && rollup -c", - "dev": "rollup -c --watch --watch.include 'src/**'", - "prepublishOnly": "pnpm build" - }, - "peerDependencies": { - "vitest": ">=0.30.0 <1" - }, - "dependencies": { - "@ampproject/remapping": "^2.2.1", - "c8": "^7.14.0", - "magic-string": "^0.30.1", - "picocolors": "^1.0.0", - "std-env": "^3.3.3" - }, - "devDependencies": { - "pathe": "^1.1.1", - "vite-node": "workspace:*", - "vitest": "workspace:*" - } -} diff --git a/packages/coverage-c8/rollup.config.js b/packages/coverage-c8/rollup.config.js deleted file mode 100644 index 05acfa29bcfc..000000000000 --- a/packages/coverage-c8/rollup.config.js +++ /dev/null @@ -1,65 +0,0 @@ -import { builtinModules } from 'node:module' -import esbuild from 'rollup-plugin-esbuild' -import dts from 'rollup-plugin-dts' -import commonjs from '@rollup/plugin-commonjs' -import json from '@rollup/plugin-json' -import alias from '@rollup/plugin-alias' -import nodeResolve from '@rollup/plugin-node-resolve' -import { join } from 'pathe' -import pkg from './package.json' assert { type: 'json' } - -const entries = { - index: 'src/index.ts', - provider: 'src/provider.ts', -} - -const external = [ - ...builtinModules, - ...Object.keys(pkg.dependencies || {}), - ...Object.keys(pkg.peerDependencies || {}), - 'node:inspector', - 'c8/lib/report.js', - 'c8/lib/commands/check-coverage.js', - 'vitest', - 'vitest/node', - 'vitest/config', - 'vitest/coverage', -] - -const plugins = [ - alias({ - entries: [ - { find: /^node:(.+)$/, replacement: '$1' }, - ], - }), - nodeResolve(), - json(), - commonjs(), - esbuild({ - target: 'node14', - }), -] - -export default () => [ - { - input: entries, - output: { - dir: 'dist', - format: 'esm', - }, - external, - plugins, - }, - { - input: entries, - output: { - dir: join(process.cwd(), 'dist'), - entryFileNames: '[name].d.ts', - format: 'esm', - }, - external, - plugins: [ - dts({ respectExternal: true }), - ], - }, -] diff --git a/packages/coverage-c8/src/index.ts b/packages/coverage-c8/src/index.ts deleted file mode 100644 index ea6998eef5c1..000000000000 --- a/packages/coverage-c8/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as coverage from './takeCoverage' - -export default { - ...coverage, - async getProvider() { - // to not bundle the provider - const name = './provider.js' - const { C8CoverageProvider } = await import(name) as typeof import('./provider') - return new C8CoverageProvider() - }, -} diff --git a/packages/coverage-c8/src/provider.ts b/packages/coverage-c8/src/provider.ts deleted file mode 100644 index 8ac20792c0f6..000000000000 --- a/packages/coverage-c8/src/provider.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { existsSync, promises as fs } from 'node:fs' -import _url from 'node:url' -import type { Profiler } from 'node:inspector' -import MagicString from 'magic-string' -import remapping from '@ampproject/remapping' -import { extname, resolve } from 'pathe' -import c from 'picocolors' -import { provider } from 'std-env' -import type { EncodedSourceMap } from 'vite-node' -import { coverageConfigDefaults } from 'vitest/config' -import { BaseCoverageProvider } from 'vitest/coverage' -import type { AfterSuiteRunMeta, CoverageC8Options, CoverageProvider, ReportContext, ResolvedCoverageOptions } from 'vitest' -import type { Vitest } from 'vitest/node' -import type { Report } from 'c8' - -// @ts-expect-error missing types -import createReport from 'c8/lib/report.js' - -// @ts-expect-error missing types -import { checkCoverages } from 'c8/lib/commands/check-coverage.js' - -type Options = ResolvedCoverageOptions<'c8'> - -// Note that this needs to match the line ending as well -const VITE_EXPORTS_LINE_PATTERN = /Object\.defineProperty\(__vite_ssr_exports__.*\n/g - -export class C8CoverageProvider extends BaseCoverageProvider implements CoverageProvider { - name = 'c8' - - ctx!: Vitest - options!: Options - coverages: Profiler.TakePreciseCoverageReturnType[] = [] - - initialize(ctx: Vitest) { - const config: CoverageC8Options = ctx.config.coverage - - this.ctx = ctx - this.options = { - ...coverageConfigDefaults, - - // Provider specific defaults - excludeNodeModules: true, - allowExternal: false, - - // User's options - ...config, - - // Resolved fields - provider: 'c8', - reporter: this.resolveReporters(config.reporter || coverageConfigDefaults.reporter), - reportsDirectory: resolve(ctx.config.root, config.reportsDirectory || coverageConfigDefaults.reportsDirectory), - lines: config['100'] ? 100 : config.lines, - functions: config['100'] ? 100 : config.functions, - branches: config['100'] ? 100 : config.branches, - statements: config['100'] ? 100 : config.statements, - } - - const banner = ' DEPRECATION ' - this.ctx.logger.log( - c.bgYellow(c.black((banner))), - c.yellow('@vitest/coverage-c8 is being replaced by @vitest/coverage-v8.'), - c.yellow(`\n${' '.repeat(banner.length)} See`), - c.blue(c.underline('https://github.com/vitest-dev/vitest/pull/3339')), - c.yellow('for more information.'), - ) - } - - resolveOptions() { - return this.options - } - - async clean(clean = true) { - if (clean && existsSync(this.options.reportsDirectory)) - await fs.rm(this.options.reportsDirectory, { recursive: true, force: true, maxRetries: 10 }) - - this.coverages = [] - } - - onAfterSuiteRun({ coverage }: AfterSuiteRunMeta) { - this.coverages.push(coverage as Profiler.TakePreciseCoverageReturnType) - } - - async reportCoverage({ allTestsRun }: ReportContext = {}) { - if (provider === 'stackblitz') - this.ctx.logger.log(c.blue(' % ') + c.yellow('@vitest/coverage-c8 does not work on Stackblitz. Report will be empty.')) - - const options: ConstructorParameters[0] = { - ...this.options, - all: this.options.all && allTestsRun, - reporter: this.options.reporter.map(([reporterName]) => reporterName), - reporterOptions: this.options.reporter.reduce((all, [name, options]) => ({ - ...all, - [name]: { - skipFull: this.options.skipFull, - projectRoot: this.ctx.config.root, - ...options, - }, - }), {}), - } - - const report = createReport(options) - - // Overwrite C8's loader as results are in memory instead of file system - report._loadReports = () => this.coverages - - interface MapAndSource { map: EncodedSourceMap; source: string | undefined } - type SourceMapMeta = { url: string; filepath: string } & MapAndSource - - // add source maps - const sourceMapMeta: Record = {} - const extensions = Array.isArray(this.options.extension) ? this.options.extension : [this.options.extension] - - const fetchCache = this.ctx.projects.map(project => - Array.from(project.vitenode.fetchCache.entries()), - ).flat() - - const entries = Array - .from(fetchCache) - .filter(entry => report._shouldInstrument(entry[0])) - .map(([file, { result }]) => { - if (!result.map) - return null - - const filepath = file.split('?')[0] - const url = _url.pathToFileURL(filepath).href - const extension = extname(file) || extname(url) - - return { - filepath, - url, - extension, - map: result.map, - source: result.code, - } - }) - .filter((entry) => { - if (!entry) - return false - - if (!extensions.includes(entry.extension)) - return false - - // Mappings and sourcesContent are needed for C8 to work - return ( - entry.map.mappings.length > 0 - && entry.map.sourcesContent - && entry.map.sourcesContent.length > 0 - && entry.map.sourcesContent[0] - && entry.map.sourcesContent[0].length > 0 - ) - }) as SourceMapMeta[] - - await Promise.all(entries.map(async ({ url, source, map, filepath }) => { - if (url in sourceMapMeta) - return - - let code: string | undefined - try { - code = (await fs.readFile(filepath)).toString() - } - catch { } - - // Vite does not report full path in sourcemap sources - // so use an actual file path - const sources = [url] - - sourceMapMeta[url] = { - source, - map: { - sourcesContent: code ? [code] : undefined, - ...map, - sources, - }, - } - })) - - // This is a magic number. It corresponds to the amount of code - // that we add in packages/vite-node/src/client.ts:114 (vm.runInThisContext) - // TODO: Include our transformations in sourcemaps - const offset = 185 - - report._getSourceMap = (coverage: Profiler.ScriptCoverage) => { - const path = _url.pathToFileURL(coverage.url.split('?')[0]).href - const data = sourceMapMeta[path] - - if (!data) - return {} - - return { - sourceMap: { - sourcemap: removeViteHelpersFromSourceMaps(data.source, data.map), - }, - source: Array(offset).fill('.').join('') + data.source, - } - } - - await report.run() - await checkCoverages(options, report) - - if (this.options.thresholdAutoUpdate && allTestsRun) { - this.updateThresholds({ - coverageMap: await report.getCoverageMapFromAllCoverageFiles(), - thresholds: { - branches: this.options.branches, - functions: this.options.functions, - lines: this.options.lines, - statements: this.options.statements, - }, - perFile: this.options.perFile, - configurationFile: this.ctx.server.config.configFile, - }) - } - } -} - -/** - * Remove generated code from the source maps: - * - Vite's export helpers: e.g. `Object.defineProperty(__vite_ssr_exports__, "sum", { enumerable: true, configurable: true, get(){ return sum }});` - */ -function removeViteHelpersFromSourceMaps(source: string | undefined, map: EncodedSourceMap) { - if (!source || !source.match(VITE_EXPORTS_LINE_PATTERN)) - return map - - const sourceWithoutHelpers = new MagicString(source) - sourceWithoutHelpers.replaceAll(VITE_EXPORTS_LINE_PATTERN, '\n') - - const mapWithoutHelpers = sourceWithoutHelpers.generateMap({ - hires: true, - }) - - // A merged source map where the first one excludes helpers - const combinedMap = remapping( - [{ ...mapWithoutHelpers, version: 3 }, map], - () => null, - ) - - return combinedMap -} diff --git a/packages/coverage-c8/src/takeCoverage.ts b/packages/coverage-c8/src/takeCoverage.ts deleted file mode 100644 index ea49e52e17ea..000000000000 --- a/packages/coverage-c8/src/takeCoverage.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * For details about the Profiler.* messages see https://chromedevtools.github.io/devtools-protocol/v8/Profiler/ -*/ - -import inspector from 'node:inspector' -import type { Profiler } from 'node:inspector' -import { provider } from 'std-env' - -const session = new inspector.Session() - -export function startCoverage() { - session.connect() - session.post('Profiler.enable') - session.post('Profiler.startPreciseCoverage', { - callCount: true, - detailed: true, - }) -} - -export async function takeCoverage() { - return new Promise((resolve, reject) => { - session.post('Profiler.takePreciseCoverage', async (error, coverage) => { - if (error) - return reject(error) - - // Reduce amount of data sent over rpc by doing some early result filtering - const result = coverage.result.filter(filterResult) - - resolve({ result }) - }) - - if (provider === 'stackblitz') - resolve({ result: [] }) - }) -} - -export function stopCoverage() { - session.post('Profiler.stopPreciseCoverage') - session.post('Profiler.disable') - session.disconnect() -} - -function filterResult(coverage: Profiler.ScriptCoverage): boolean { - if (!coverage.url.startsWith('file://')) - return false - - if (coverage.url.includes('/node_modules/')) - return false - - return true -} diff --git a/packages/vite-node/src/client.ts b/packages/vite-node/src/client.ts index 14c75c3b67eb..f930bf83f07d 100644 --- a/packages/vite-node/src/client.ts +++ b/packages/vite-node/src/client.ts @@ -384,7 +384,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/coverage-c8/src/provider.ts#86 if you do change this + // adjust `WRAPPER_LENGTH` variable in packages/coverage-v8/src/provider.ts if you do change this const context = this.prepareContext({ // esm transformed by Vite __vite_ssr_import__: request, diff --git a/packages/vitest/src/defaults.ts b/packages/vitest/src/defaults.ts index 35014220a009..10040a9486dc 100644 --- a/packages/vitest/src/defaults.ts +++ b/packages/vitest/src/defaults.ts @@ -34,8 +34,6 @@ export const coverageConfigDefaults: ResolvedCoverageOptions = { exclude: defaultCoverageExcludes, reportOnFailure: false, reporter: [['text', {}], ['html', {}], ['clover', {}], ['json', {}]], - // default extensions used by c8, plus '.vue' and '.svelte' - // see https://github.com/istanbuljs/schema/blob/master/default-extension.js extension: ['.js', '.cjs', '.mjs', '.ts', '.mts', '.cts', '.tsx', '.jsx', '.vue', '.svelte'], } diff --git a/packages/vitest/src/integrations/coverage.ts b/packages/vitest/src/integrations/coverage.ts index db35ec79cbdc..0215849cc6c2 100644 --- a/packages/vitest/src/integrations/coverage.ts +++ b/packages/vitest/src/integrations/coverage.ts @@ -5,7 +5,6 @@ interface Loader { } export const CoverageProviderMap: Record = { - c8: '@vitest/coverage-c8', v8: '@vitest/coverage-v8', istanbul: '@vitest/coverage-istanbul', } @@ -16,7 +15,7 @@ async function resolveCoverageProviderModule(options: CoverageOptions | undefine const provider = options.provider - if (provider === 'c8' || provider === 'v8' || provider === 'istanbul') { + if (provider === 'v8' || provider === 'istanbul') { const { default: coverageModule } = await loader.executeId(CoverageProviderMap[provider]) if (!coverageModule) diff --git a/packages/vitest/src/node/cli-api.ts b/packages/vitest/src/node/cli-api.ts index c48490577946..de9b328a33ef 100644 --- a/packages/vitest/src/node/cli-api.ts +++ b/packages/vitest/src/node/cli-api.ts @@ -63,17 +63,7 @@ export async function startVitest( const requiredPackages = CoverageProviderMap[provider] if (requiredPackages) { - // Remove this message once support for @vitest/coverage-c8 has been removed completely - const defaultProviderInfo = 'Default coverage provider has changed from "c8" to "v8". ' - + 'New package is required to be installed. ' - + 'To use the old deprecated coverage provider use "--coverage.provider c8" option.\n' - + 'See https://github.com/vitest-dev/vitest/pull/3339 for more information.\n\n' - - const isUsingDefaultProvider - = ctx.server.config.test?.coverage?.provider === undefined - && options.coverage?.provider === undefined - - if (!await ensurePackageInstalled(requiredPackages, root, isUsingDefaultProvider ? defaultProviderInfo : undefined)) { + if (!await ensurePackageInstalled(requiredPackages, root)) { process.exitCode = 1 return ctx } diff --git a/packages/vitest/src/node/cli.ts b/packages/vitest/src/node/cli.ts index f8d16d7b3975..c4573ed3ce3b 100644 --- a/packages/vitest/src/node/cli.ts +++ b/packages/vitest/src/node/cli.ts @@ -3,7 +3,7 @@ import cac from 'cac' import c from 'picocolors' import { version } from '../../package.json' import { toArray } from '../utils' -import type { BaseCoverageOptions, CoverageC8Options, CoverageIstanbulOptions, Vitest, VitestRunMode } from '../types' +import type { BaseCoverageOptions, CoverageIstanbulOptions, Vitest, VitestRunMode } from '../types' import type { CliOptions } from './cli-api' import { startVitest } from './cli-api' import { divider } from './reporters/renderers/utils' @@ -159,9 +159,6 @@ function normalizeCliOptions(argv: CliOptions): CliOptions { if ((coverage as CoverageIstanbulOptions).ignoreClassMethods) (coverage as CoverageIstanbulOptions).ignoreClassMethods = toArray((coverage as CoverageIstanbulOptions).ignoreClassMethods) - - if ((coverage as CoverageC8Options).src) - (coverage as CoverageC8Options).src = toArray((coverage as CoverageC8Options).src) } return argv } diff --git a/packages/vitest/src/node/config.ts b/packages/vitest/src/node/config.ts index b1cb96922097..947bdfc7d895 100644 --- a/packages/vitest/src/node/config.ts +++ b/packages/vitest/src/node/config.ts @@ -117,8 +117,9 @@ export function resolveConfig( } } - if (resolved.coverage.provider === 'c8' && resolved.coverage.enabled && isBrowserEnabled(resolved)) - throw new Error('@vitest/coverage-c8 does not work with --browser. Use @vitest/coverage-istanbul instead') + // @ts-expect-error -- check for removed API option + if (resolved.coverage.provider === 'c8') + throw new Error('"coverage.provider: c8" is not supported anymore. Use "coverage.provider: v8" instead') if (resolved.coverage.provider === 'v8' && resolved.coverage.enabled && isBrowserEnabled(resolved)) throw new Error('@vitest/coverage-v8 does not work with --browser. Use @vitest/coverage-istanbul instead') diff --git a/packages/vitest/src/node/pkg.ts b/packages/vitest/src/node/pkg.ts index 36475498107a..f1de8b90d01c 100644 --- a/packages/vitest/src/node/pkg.ts +++ b/packages/vitest/src/node/pkg.ts @@ -9,16 +9,12 @@ const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) export async function ensurePackageInstalled( dependency: string, root: string, - errorMessage?: string, ) { if (isPackageExists(dependency, { paths: [root, __dirname] })) return true const promptInstall = !isCI && process.stdout.isTTY - if (errorMessage) - process.stderr.write(c.red(errorMessage)) - process.stderr.write(c.red(`${c.inverse(c.red(' MISSING DEP '))} Can not find dependency '${dependency}'\n\n`)) if (!promptInstall) diff --git a/packages/vitest/src/types/coverage.ts b/packages/vitest/src/types/coverage.ts index 75987eb9f44f..11c14578b0c5 100644 --- a/packages/vitest/src/types/coverage.ts +++ b/packages/vitest/src/types/coverage.ts @@ -61,14 +61,13 @@ type CoverageReporterWithOptions] : never -type Provider = 'c8' | 'v8' | 'istanbul' | 'custom' | undefined +type Provider = 'v8' | 'istanbul' | 'custom' | undefined export type CoverageOptions = T extends 'istanbul' ? ({ provider: T } & CoverageIstanbulOptions) : - T extends 'c8' ? ({ provider: T } & CoverageC8Options) : - T extends 'v8' ? ({ provider: T } & CoverageV8Options) : - T extends 'custom' ? ({ provider: T } & CustomProviderOptions) : - ({ provider?: T } & (CoverageC8Options)) + T extends 'v8' ? ({ provider: T } & CoverageV8Options) : + T extends 'custom' ? ({ provider: T } & CustomProviderOptions) : + ({ provider?: T } & (CoverageV8Options)) /** Fields that have default values. Internally these will always be defined. */ type FieldsWithDefaultValues = @@ -228,36 +227,6 @@ export interface CoverageIstanbulOptions extends BaseCoverageOptions { ignoreClassMethods?: string[] } -export interface CoverageC8Options extends BaseCoverageOptions { - /** - * Allow files from outside of your cwd. - * - * @default false - */ - allowExternal?: boolean - - /** - * Exclude coverage under `/node_modules/` - * - * @default true - */ - excludeNodeModules?: boolean - - /** - * Specifies the directories that are used when `--all` is enabled. - * - * @default cwd - */ - src?: string[] - - /** - * Shortcut for `--check-coverage --lines 100 --functions 100 --branches 100 --statements 100` - * - * @default false - */ - 100?: boolean -} - export interface CoverageV8Options extends BaseCoverageOptions { /** * Shortcut for `--check-coverage --lines 100 --functions 100 --branches 100 --statements 100` diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef0b016e5ee1..7438ef3ea539 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,9 +45,6 @@ importers: '@vitest/browser': specifier: workspace:* version: link:packages/browser - '@vitest/coverage-c8': - specifier: workspace:* - version: link:packages/coverage-c8 '@vitest/coverage-istanbul': specifier: workspace:* version: link:packages/coverage-istanbul @@ -619,9 +616,9 @@ importers: '@vitejs/plugin-react': specifier: latest version: 4.0.3(vite@4.3.9) - '@vitest/coverage-c8': - specifier: ^0.24.5 - version: 0.24.5 + '@vitest/coverage-v8': + specifier: latest + version: link:../../packages/coverage-v8 '@vitest/ui': specifier: latest version: link:../../packages/ui @@ -929,34 +926,6 @@ importers: specifier: workspace:* version: link:../vitest - packages/coverage-c8: - dependencies: - '@ampproject/remapping': - specifier: ^2.2.1 - version: 2.2.1 - c8: - specifier: ^7.14.0 - version: 7.14.0 - magic-string: - specifier: ^0.30.1 - version: 0.30.1 - picocolors: - specifier: ^1.0.0 - version: 1.0.0 - std-env: - specifier: ^3.3.3 - version: 3.3.3 - devDependencies: - pathe: - specifier: ^1.1.1 - version: 1.1.1 - vite-node: - specifier: workspace:* - version: link:../vite-node - vitest: - specifier: workspace:* - version: link:../vitest - packages/coverage-istanbul: dependencies: istanbul-lib-coverage: @@ -1622,9 +1591,6 @@ importers: '@vitest/browser': specifier: workspace:* version: link:../../packages/browser - '@vitest/coverage-c8': - specifier: workspace:* - version: link:../../packages/coverage-c8 '@vitest/coverage-istanbul': specifier: workspace:* version: link:../../packages/coverage-istanbul @@ -9573,13 +9539,6 @@ packages: vue: 3.3.4 dev: true - /@vitest/coverage-c8@0.24.5: - resolution: {integrity: sha512-955yK/SdSBZPYrSXgXB0F+0JnOX5EY9kSL7ywJ4rNajmkFUhwLjuKm13Xb6YKSyIY/g5WvbBnyowqfNRxBJ3ww==} - dependencies: - c8: 7.12.0 - vitest: link:packages/vitest - dev: true - /@volar/code-gen@0.40.13: resolution: {integrity: sha512-4gShBWuMce868OVvgyA1cU5WxHbjfEme18Tw6uVMfweZCF5fB2KECG0iPrA9D54vHk3FeHarODNwgIaaFfUBlA==} dependencies: @@ -11651,25 +11610,6 @@ packages: - supports-color dev: true - /c8@7.12.0: - resolution: {integrity: sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==} - engines: {node: '>=10.12.0'} - hasBin: true - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@istanbuljs/schema': 0.1.3 - find-up: 5.0.0 - foreground-child: 2.0.0 - istanbul-lib-coverage: 3.2.0 - istanbul-lib-report: 3.0.0 - istanbul-reports: 3.1.5 - rimraf: 3.0.2 - test-exclude: 6.0.0 - v8-to-istanbul: 9.1.0 - yargs: 16.2.0 - yargs-parser: 20.2.9 - dev: true - /c8@7.14.0: resolution: {integrity: sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==} engines: {node: '>=10.12.0'} @@ -11687,6 +11627,7 @@ packages: v8-to-istanbul: 9.1.0 yargs: 16.2.0 yargs-parser: 20.2.9 + dev: true /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} diff --git a/test/config/test/failures.test.ts b/test/config/test/failures.test.ts index 0ad1bf064faa..745006b313ba 100644 --- a/test/config/test/failures.test.ts +++ b/test/config/test/failures.test.ts @@ -48,10 +48,11 @@ test('inspect-brk cannot be used with threads', async () => { expect(stderr).toMatch('Error: You cannot use --inspect-brk without "threads: false" or "singleThread: true"') }) -test('c8 coverage provider cannot be used with browser', async () => { - const { stderr } = await runVitest({ coverage: { enabled: true, provider: 'c8' }, browser: { enabled: true, name: 'chrome' } }) +test('c8 coverage provider is not supported', async () => { + // @ts-expect-error -- check for removed API option + const { stderr } = await runVitest({ coverage: { enabled: true, provider: 'c8' } }) - expect(stderr).toMatch('Error: @vitest/coverage-c8 does not work with --browser. Use @vitest/coverage-istanbul instead') + expect(stderr).toMatch('Error: "coverage.provider: c8" is not supported anymore. Use "coverage.provider: v8" instead') }) test('v8 coverage provider cannot be used with browser', async () => { diff --git a/test/coverage-test/coverage-report-tests/__snapshots__/c8.report.test.ts.snap b/test/coverage-test/coverage-report-tests/__snapshots__/c8.report.test.ts.snap deleted file mode 100644 index 92bc21c5e1fe..000000000000 --- a/test/coverage-test/coverage-report-tests/__snapshots__/c8.report.test.ts.snap +++ /dev/null @@ -1,4230 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`c8 json report 1`] = ` -{ - "/src/Counter/Counter.component.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - "1": [ - 2, - ], - }, - "branchMap": { - "0": { - "line": 6, - "loc": { - "end": { - "column": 4, - "line": 9, - }, - "start": { - "column": 2, - "line": 6, - }, - }, - "locations": [ - { - "end": { - "column": 4, - "line": 9, - }, - "start": { - "column": 2, - "line": 6, - }, - }, - ], - "type": "branch", - }, - "1": { - "line": 16, - "loc": { - "end": { - "column": 6, - "line": 18, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - "locations": [ - { - "end": { - "column": 6, - "line": 18, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - "1": 0, - "2": 2, - "3": 0, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 4, - "line": 9, - }, - "start": { - "column": 2, - "line": 6, - }, - }, - "line": 6, - "loc": { - "end": { - "column": 4, - "line": 9, - }, - "start": { - "column": 2, - "line": 6, - }, - }, - "name": "setup", - }, - "1": { - "decl": { - "end": { - "column": 6, - "line": 14, - }, - "start": { - "column": 4, - "line": 12, - }, - }, - "line": 12, - "loc": { - "end": { - "column": 6, - "line": 14, - }, - "start": { - "column": 4, - "line": 12, - }, - }, - "name": "uncoveredMethod", - }, - "2": { - "decl": { - "end": { - "column": 6, - "line": 18, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - "line": 16, - "loc": { - "end": { - "column": 6, - "line": 18, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - "name": "coveredMethod", - }, - "3": { - "decl": { - "end": { - "column": 6, - "line": 22, - }, - "start": { - "column": 4, - "line": 20, - }, - }, - "line": 20, - "loc": { - "end": { - "column": 6, - "line": 22, - }, - "start": { - "column": 4, - "line": 20, - }, - }, - "name": "uncoveredMethodUsingImportMeta", - }, - }, - "path": "/src/Counter/Counter.component.ts", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 0, - "13": 0, - "14": 1, - "15": 1, - "16": 2, - "17": 2, - "18": 1, - "19": 1, - "2": 1, - "20": 0, - "21": 0, - "22": 1, - "23": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 1, - "7": 1, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 42, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 0, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 12, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 23, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 46, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 6, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 0, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 21, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 42, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 6, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 0, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 38, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 32, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "20": { - "end": { - "column": 94, - "line": 21, - }, - "start": { - "column": 0, - "line": 21, - }, - }, - "21": { - "end": { - "column": 6, - "line": 22, - }, - "start": { - "column": 0, - "line": 22, - }, - }, - "22": { - "end": { - "column": 4, - "line": 23, - }, - "start": { - "column": 0, - "line": 23, - }, - }, - "23": { - "end": { - "column": 2, - "line": 24, - }, - "start": { - "column": 0, - "line": 24, - }, - }, - "3": { - "end": { - "column": 18, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 0, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 11, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 24, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 20, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 4, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 0, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/Counter/Counter.vue": { - "all": false, - "b": { - "0": [ - 1, - ], - "1": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 8, - "loc": { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - "locations": [ - { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - ], - "type": "branch", - }, - "1": { - "line": 8, - "loc": { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - "locations": [ - { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - "line": 8, - "loc": { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 18, - "line": 8, - }, - }, - "name": "__vite_ssr_import_1__.createElementBlock.__vite_ssr_import_1__.createElementVNode.onClick._cache.._cache.", - }, - }, - "path": "/src/Counter/Counter.vue", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 1, - "13": 1, - "2": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 1, - "7": 1, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 56, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 0, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 14, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 25, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 8, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 11, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "2": { - "end": { - "column": 10, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 27, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 15, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 11, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 0, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 25, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 27, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 8, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/Counter/index.ts": { - "all": false, - "b": {}, - "branchMap": {}, - "f": {}, - "fnMap": {}, - "path": "/src/Counter/index.ts", - "s": { - "0": 1, - "1": 1, - "2": 1, - "3": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 50, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 38, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "2": { - "end": { - "column": 0, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 39, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - }, - }, - "/src/Defined.vue": { - "all": false, - "b": { - "0": [ - 0, - ], - }, - "branchMap": { - "0": { - "line": 6, - "loc": { - "end": { - "column": 36, - "line": 8, - }, - "start": { - "column": 33, - "line": 6, - }, - }, - "locations": [ - { - "end": { - "column": 36, - "line": 8, - }, - "start": { - "column": 33, - "line": 6, - }, - }, - ], - "type": "branch", - }, - }, - "f": {}, - "fnMap": {}, - "path": "/src/Defined.vue", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 1, - "13": 1, - "14": 1, - "15": 1, - "16": 1, - "17": 1, - "18": 1, - "19": 1, - "2": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 0, - "7": 0, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 24, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 27, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 10, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 15, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 11, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 0, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 90, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 25, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 6, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 25, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 8, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 0, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 31, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 12, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 34, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 4, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 36, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 9, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 0, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/Hello.vue": { - "all": false, - "b": { - "0": [ - 3, - ], - }, - "branchMap": { - "0": { - "line": 7, - "loc": { - "end": { - "column": 55, - "line": 7, - }, - "start": { - "column": 24, - "line": 7, - }, - }, - "locations": [ - { - "end": { - "column": 55, - "line": 7, - }, - "start": { - "column": 24, - "line": 7, - }, - }, - ], - "type": "branch", - }, - }, - "f": {}, - "fnMap": {}, - "path": "/src/Hello.vue", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 1, - "13": 1, - "14": 1, - "15": 1, - "16": 1, - "2": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 1, - "7": 1, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 24, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 35, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 0, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 10, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 53, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 30, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 6, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 11, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 11, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "2": { - "end": { - "column": 0, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 46, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 0, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 20, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 56, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 0, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 19, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 9, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/dynamic-file-esm.ignore.mjs": { - "all": false, - "b": { - "0": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 2, - "loc": { - "end": { - "column": 1, - "line": 4, - }, - "start": { - "column": 7, - "line": 2, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 4, - }, - "start": { - "column": 7, - "line": 2, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - "1": 0, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 4, - }, - "start": { - "column": 7, - "line": 2, - }, - }, - "line": 2, - "loc": { - "end": { - "column": 1, - "line": 4, - }, - "start": { - "column": 7, - "line": 2, - }, - }, - "name": "run", - }, - "1": { - "decl": { - "end": { - "column": 23, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "line": 5, - "loc": { - "end": { - "column": 23, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "name": "uncovered", - }, - }, - "path": "/src/dynamic-file-esm.ignore.mjs", - "s": { - "0": 1, - "1": 1, - "2": 1, - "3": 1, - "4": 0, - }, - "statementMap": { - "0": { - "end": { - "column": 53, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 23, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "2": { - "end": { - "column": 23, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 1, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 23, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - }, - }, - "/src/dynamic-files.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - "1": [ - 0, - ], - "2": [ - 0, - ], - "3": [ - 1, - ], - "4": [ - 0, - ], - "5": [ - 0, - ], - }, - "branchMap": { - "0": { - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 25, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 25, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - ], - "type": "branch", - }, - "1": { - "line": 9, - "loc": { - "end": { - "column": 20, - "line": 9, - }, - "start": { - "column": 4, - "line": 9, - }, - }, - "locations": [ - { - "end": { - "column": 20, - "line": 9, - }, - "start": { - "column": 4, - "line": 9, - }, - }, - ], - "type": "branch", - }, - "2": { - "line": 22, - "loc": { - "end": { - "column": 48, - "line": 22, - }, - "start": { - "column": 4, - "line": 22, - }, - }, - "locations": [ - { - "end": { - "column": 48, - "line": 22, - }, - "start": { - "column": 4, - "line": 22, - }, - }, - ], - "type": "branch", - }, - "3": { - "line": 27, - "loc": { - "end": { - "column": 1, - "line": 47, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 47, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - ], - "type": "branch", - }, - "4": { - "line": 31, - "loc": { - "end": { - "column": 20, - "line": 31, - }, - "start": { - "column": 4, - "line": 31, - }, - }, - "locations": [ - { - "end": { - "column": 20, - "line": 31, - }, - "start": { - "column": 4, - "line": 31, - }, - }, - ], - "type": "branch", - }, - "5": { - "line": 44, - "loc": { - "end": { - "column": 48, - "line": 44, - }, - "start": { - "column": 4, - "line": 44, - }, - }, - "locations": [ - { - "end": { - "column": 48, - "line": 44, - }, - "start": { - "column": 4, - "line": 44, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - "1": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 25, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 25, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "name": "runDynamicFileESM", - }, - "1": { - "decl": { - "end": { - "column": 1, - "line": 47, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "line": 27, - "loc": { - "end": { - "column": 1, - "line": 47, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "name": "runDynamicFileCJS", - }, - }, - "path": "/src/dynamic-files.ts", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 1, - "13": 1, - "14": 1, - "15": 1, - "16": 1, - "17": 1, - "18": 1, - "19": 1, - "2": 1, - "20": 1, - "21": 1, - "22": 1, - "23": 1, - "24": 1, - "25": 1, - "26": 1, - "27": 1, - "28": 1, - "29": 1, - "3": 1, - "30": 1, - "31": 1, - "32": 1, - "33": 1, - "34": 1, - "35": 1, - "36": 1, - "37": 1, - "38": 1, - "39": 1, - "4": 1, - "40": 1, - "41": 1, - "42": 1, - "43": 1, - "44": 1, - "45": 1, - "46": 1, - "5": 1, - "6": 1, - "7": 1, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 59, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 43, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 27, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 53, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 23, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 23, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 1, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 23, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 20, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 0, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 40, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 0, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 40, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "20": { - "end": { - "column": 31, - "line": 21, - }, - "start": { - "column": 0, - "line": 21, - }, - }, - "21": { - "end": { - "column": 48, - "line": 22, - }, - "start": { - "column": 0, - "line": 22, - }, - }, - "22": { - "end": { - "column": 0, - "line": 23, - }, - "start": { - "column": 0, - "line": 23, - }, - }, - "23": { - "end": { - "column": 18, - "line": 24, - }, - "start": { - "column": 0, - "line": 24, - }, - }, - "24": { - "end": { - "column": 1, - "line": 25, - }, - "start": { - "column": 0, - "line": 25, - }, - }, - "25": { - "end": { - "column": 0, - "line": 26, - }, - "start": { - "column": 0, - "line": 26, - }, - }, - "26": { - "end": { - "column": 43, - "line": 27, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "27": { - "end": { - "column": 90, - "line": 28, - }, - "start": { - "column": 0, - "line": 28, - }, - }, - "28": { - "end": { - "column": 0, - "line": 29, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "29": { - "end": { - "column": 27, - "line": 30, - }, - "start": { - "column": 0, - "line": 30, - }, - }, - "3": { - "end": { - "column": 0, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "30": { - "end": { - "column": 20, - "line": 31, - }, - "start": { - "column": 0, - "line": 31, - }, - }, - "31": { - "end": { - "column": 0, - "line": 32, - }, - "start": { - "column": 0, - "line": 32, - }, - }, - "32": { - "end": { - "column": 27, - "line": 33, - }, - "start": { - "column": 0, - "line": 33, - }, - }, - "33": { - "end": { - "column": 53, - "line": 34, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - "34": { - "end": { - "column": 37, - "line": 35, - }, - "start": { - "column": 0, - "line": 35, - }, - }, - "35": { - "end": { - "column": 23, - "line": 36, - }, - "start": { - "column": 0, - "line": 36, - }, - }, - "36": { - "end": { - "column": 1, - "line": 37, - }, - "start": { - "column": 0, - "line": 37, - }, - }, - "37": { - "end": { - "column": 23, - "line": 38, - }, - "start": { - "column": 0, - "line": 38, - }, - }, - "38": { - "end": { - "column": 20, - "line": 39, - }, - "start": { - "column": 0, - "line": 39, - }, - }, - "39": { - "end": { - "column": 0, - "line": 40, - }, - "start": { - "column": 0, - "line": 40, - }, - }, - "4": { - "end": { - "column": 43, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "40": { - "end": { - "column": 58, - "line": 41, - }, - "start": { - "column": 0, - "line": 41, - }, - }, - "41": { - "end": { - "column": 0, - "line": 42, - }, - "start": { - "column": 0, - "line": 42, - }, - }, - "42": { - "end": { - "column": 31, - "line": 43, - }, - "start": { - "column": 0, - "line": 43, - }, - }, - "43": { - "end": { - "column": 48, - "line": 44, - }, - "start": { - "column": 0, - "line": 44, - }, - }, - "44": { - "end": { - "column": 0, - "line": 45, - }, - "start": { - "column": 0, - "line": 45, - }, - }, - "45": { - "end": { - "column": 18, - "line": 46, - }, - "start": { - "column": 0, - "line": 46, - }, - }, - "46": { - "end": { - "column": 1, - "line": 47, - }, - "start": { - "column": 0, - "line": 47, - }, - }, - "5": { - "end": { - "column": 91, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 0, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 27, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 20, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 0, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/function-count.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - "1": [ - 1, - ], - "2": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 11, - "loc": { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 17, - "line": 11, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 17, - "line": 11, - }, - }, - ], - "type": "branch", - }, - "1": { - "line": 18, - "loc": { - "end": { - "column": 1, - "line": 21, - }, - "start": { - "column": 7, - "line": 18, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 21, - }, - "start": { - "column": 7, - "line": 18, - }, - }, - ], - "type": "branch", - }, - "2": { - "line": 34, - "loc": { - "end": { - "column": 1, - "line": 36, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 36, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - "1": 1, - "2": 0, - "3": 0, - "4": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 17, - "line": 11, - }, - }, - "line": 11, - "loc": { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 17, - "line": 11, - }, - }, - "name": "first", - }, - "1": { - "decl": { - "end": { - "column": 1, - "line": 21, - }, - "start": { - "column": 7, - "line": 18, - }, - }, - "line": 18, - "loc": { - "end": { - "column": 1, - "line": 21, - }, - "start": { - "column": 7, - "line": 18, - }, - }, - "name": "second", - }, - "2": { - "decl": { - "end": { - "column": 1, - "line": 26, - }, - "start": { - "column": 7, - "line": 24, - }, - }, - "line": 24, - "loc": { - "end": { - "column": 1, - "line": 26, - }, - "start": { - "column": 7, - "line": 24, - }, - }, - "name": "third", - }, - "3": { - "decl": { - "end": { - "column": 1, - "line": 31, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "line": 29, - "loc": { - "end": { - "column": 1, - "line": 31, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "name": "fourth", - }, - "4": { - "decl": { - "end": { - "column": 1, - "line": 36, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - "line": 34, - "loc": { - "end": { - "column": 1, - "line": 36, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - "name": "fifth", - }, - }, - "path": "/src/function-count.ts", - "s": { - "0": 1, - "1": 1, - "10": 1, - "11": 1, - "12": 1, - "13": 1, - "14": 1, - "15": 1, - "16": 1, - "17": 1, - "18": 1, - "19": 1, - "2": 1, - "20": 1, - "21": 1, - "22": 1, - "23": 1, - "24": 0, - "25": 0, - "26": 1, - "27": 1, - "28": 0, - "29": 0, - "3": 1, - "30": 0, - "31": 1, - "32": 1, - "33": 1, - "34": 1, - "35": 1, - "4": 1, - "5": 1, - "6": 1, - "7": 1, - "8": 1, - "9": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 2, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 25, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 18, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 10, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 0, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 7, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 0, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 27, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 26, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 9, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 10, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 25, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "20": { - "end": { - "column": 1, - "line": 21, - }, - "start": { - "column": 0, - "line": 21, - }, - }, - "21": { - "end": { - "column": 0, - "line": 22, - }, - "start": { - "column": 0, - "line": 22, - }, - }, - "22": { - "end": { - "column": 31, - "line": 23, - }, - "start": { - "column": 0, - "line": 23, - }, - }, - "23": { - "end": { - "column": 25, - "line": 24, - }, - "start": { - "column": 0, - "line": 24, - }, - }, - "24": { - "end": { - "column": 46, - "line": 25, - }, - "start": { - "column": 0, - "line": 25, - }, - }, - "25": { - "end": { - "column": 1, - "line": 26, - }, - "start": { - "column": 0, - "line": 26, - }, - }, - "26": { - "end": { - "column": 0, - "line": 27, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "27": { - "end": { - "column": 31, - "line": 28, - }, - "start": { - "column": 0, - "line": 28, - }, - }, - "28": { - "end": { - "column": 19, - "line": 29, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "29": { - "end": { - "column": 10, - "line": 30, - }, - "start": { - "column": 0, - "line": 30, - }, - }, - "3": { - "end": { - "column": 24, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "30": { - "end": { - "column": 1, - "line": 31, - }, - "start": { - "column": 0, - "line": 31, - }, - }, - "31": { - "end": { - "column": 0, - "line": 32, - }, - "start": { - "column": 0, - "line": 32, - }, - }, - "32": { - "end": { - "column": 27, - "line": 33, - }, - "start": { - "column": 0, - "line": 33, - }, - }, - "33": { - "end": { - "column": 18, - "line": 34, - }, - "start": { - "column": 0, - "line": 34, - }, - }, - "34": { - "end": { - "column": 10, - "line": 35, - }, - "start": { - "column": 0, - "line": 35, - }, - }, - "35": { - "end": { - "column": 1, - "line": 36, - }, - "start": { - "column": 0, - "line": 36, - }, - }, - "4": { - "end": { - "column": 26, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 3, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 0, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 50, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 0, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 27, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/implicitElse.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 49, - "line": 1, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 49, - "line": 1, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 49, - "line": 1, - }, - }, - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 49, - "line": 1, - }, - }, - "name": "implicitElse", - }, - }, - "path": "/src/implicitElse.ts", - "s": { - "0": 1, - "1": 1, - "2": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 1, - "7": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 50, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 11, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "2": { - "end": { - "column": 0, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 16, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 9, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 0, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 10, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - }, - }, - "/src/importEnv.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 31, - "line": 1, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 31, - "line": 1, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 31, - "line": 1, - }, - }, - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 31, - "line": 1, - }, - }, - "name": "useImportEnv", - }, - }, - "path": "/src/importEnv.ts", - "s": { - "0": 1, - "1": 1, - "2": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 32, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 46, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "2": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - }, - }, - "/src/index.mts": { - "all": false, - "b": { - "0": [ - 1, - ], - }, - "branchMap": { - "0": { - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "name": "pythagoras", - }, - }, - "path": "/src/index.mts", - "s": { - "0": 1, - "1": 1, - "2": 1, - "3": 1, - "4": 1, - "5": 1, - "6": 1, - }, - "statementMap": { - "0": { - "end": { - "column": 45, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 0, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "2": { - "end": { - "column": 23, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "3": { - "end": { - "column": 0, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 50, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 50, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - }, - }, - "/src/untested-file.ts": { - "all": true, - "b": { - "0": [ - 0, - ], - }, - "branchMap": { - "0": { - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 33, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 33, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 0, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 33, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 33, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "name": "(empty-report)", - }, - }, - "path": "/src/untested-file.ts", - "s": { - "0": 0, - "1": 0, - "10": 0, - "11": 0, - "12": 0, - "13": 0, - "14": 0, - "15": 0, - "16": 0, - "17": 0, - "18": 0, - "19": 0, - "2": 0, - "20": 0, - "21": 0, - "22": 0, - "23": 0, - "24": 0, - "25": 0, - "26": 0, - "27": 0, - "28": 0, - "29": 0, - "3": 0, - "30": 0, - "31": 0, - "32": 0, - "4": 0, - "5": 0, - "6": 0, - "7": 0, - "8": 0, - "9": 0, - }, - "statementMap": { - "0": { - "end": { - "column": 2, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 68, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 36, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 14, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 1, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 0, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 41, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 36, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 14, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 1, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 0, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 65, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 25, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "20": { - "end": { - "column": 25, - "line": 21, - }, - "start": { - "column": 0, - "line": 21, - }, - }, - "21": { - "end": { - "column": 38, - "line": 22, - }, - "start": { - "column": 0, - "line": 22, - }, - }, - "22": { - "end": { - "column": 25, - "line": 23, - }, - "start": { - "column": 0, - "line": 23, - }, - }, - "23": { - "end": { - "column": 3, - "line": 24, - }, - "start": { - "column": 0, - "line": 24, - }, - }, - "24": { - "end": { - "column": 0, - "line": 25, - }, - "start": { - "column": 0, - "line": 25, - }, - }, - "25": { - "end": { - "column": 25, - "line": 26, - }, - "start": { - "column": 0, - "line": 26, - }, - }, - "26": { - "end": { - "column": 38, - "line": 27, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "27": { - "end": { - "column": 20, - "line": 28, - }, - "start": { - "column": 0, - "line": 28, - }, - }, - "28": { - "end": { - "column": 3, - "line": 29, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "29": { - "end": { - "column": 0, - "line": 30, - }, - "start": { - "column": 0, - "line": 30, - }, - }, - "3": { - "end": { - "column": 2, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "30": { - "end": { - "column": 36, - "line": 31, - }, - "start": { - "column": 0, - "line": 31, - }, - }, - "31": { - "end": { - "column": 41, - "line": 32, - }, - "start": { - "column": 0, - "line": 32, - }, - }, - "32": { - "end": { - "column": 1, - "line": 33, - }, - "start": { - "column": 0, - "line": 33, - }, - }, - "4": { - "end": { - "column": 0, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 40, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 72, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 1, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 0, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 36, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, - "/src/utils.ts": { - "all": false, - "b": { - "0": [ - 1, - ], - "1": [ - 2, - ], - "2": [ - 1, - ], - "3": [ - 0, - ], - }, - "branchMap": { - "0": { - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 42, - "line": 1, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 42, - "line": 1, - }, - }, - ], - "type": "branch", - }, - "1": { - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - ], - "type": "branch", - }, - "2": { - "line": 14, - "loc": { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 7, - "line": 14, - }, - }, - "locations": [ - { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 7, - "line": 14, - }, - }, - ], - "type": "branch", - }, - "3": { - "line": 16, - "loc": { - "end": { - "column": 51, - "line": 16, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - "locations": [ - { - "end": { - "column": 51, - "line": 16, - }, - "start": { - "column": 4, - "line": 16, - }, - }, - ], - "type": "branch", - }, - }, - "f": { - "0": 1, - "1": 2, - "2": 0, - "3": 1, - "4": 0, - "5": 1, - }, - "fnMap": { - "0": { - "decl": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 42, - "line": 1, - }, - }, - "line": 1, - "loc": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 42, - "line": 1, - }, - }, - "name": "add", - }, - "1": { - "decl": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "line": 5, - "loc": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 7, - "line": 5, - }, - }, - "name": "multiply", - }, - "2": { - "decl": { - "end": { - "column": 1, - "line": 12, - }, - "start": { - "column": 7, - "line": 9, - }, - }, - "line": 9, - "loc": { - "end": { - "column": 1, - "line": 12, - }, - "start": { - "column": 7, - "line": 9, - }, - }, - "name": "divide", - }, - "3": { - "decl": { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 7, - "line": 14, - }, - }, - "line": 14, - "loc": { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 7, - "line": 14, - }, - }, - "name": "sqrt", - }, - "4": { - "decl": { - "end": { - "column": 1, - "line": 24, - }, - "start": { - "column": 7, - "line": 21, - }, - }, - "line": 21, - "loc": { - "end": { - "column": 1, - "line": 24, - }, - "start": { - "column": 7, - "line": 21, - }, - }, - "name": "run", - }, - "5": { - "decl": { - "end": { - "column": 1, - "line": 30, - }, - "start": { - "column": 7, - "line": 28, - }, - }, - "line": 28, - "loc": { - "end": { - "column": 1, - "line": 30, - }, - "start": { - "column": 7, - "line": 28, - }, - }, - "name": "ignoredFunction", - }, - }, - "path": "/src/utils.ts", - "s": { - "0": 1, - "1": 1, - "10": 0, - "11": 0, - "12": 1, - "13": 1, - "14": 1, - "15": 1, - "16": 1, - "17": 1, - "18": 1, - "19": 1, - "2": 1, - "20": 1, - "21": 0, - "22": 0, - "23": 0, - "24": 1, - "25": 1, - "26": 1, - "27": 1, - "28": 1, - "29": 1, - "3": 1, - "4": 1, - "5": 2, - "6": 2, - "7": 1, - "8": 1, - "9": 0, - }, - "statementMap": { - "0": { - "end": { - "column": 43, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "1": { - "end": { - "column": 14, - "line": 2, - }, - "start": { - "column": 0, - "line": 2, - }, - }, - "10": { - "end": { - "column": 14, - "line": 11, - }, - "start": { - "column": 0, - "line": 11, - }, - }, - "11": { - "end": { - "column": 1, - "line": 12, - }, - "start": { - "column": 0, - "line": 12, - }, - }, - "12": { - "end": { - "column": 0, - "line": 13, - }, - "start": { - "column": 0, - "line": 13, - }, - }, - "13": { - "end": { - "column": 33, - "line": 14, - }, - "start": { - "column": 0, - "line": 14, - }, - }, - "14": { - "end": { - "column": 12, - "line": 15, - }, - "start": { - "column": 0, - "line": 15, - }, - }, - "15": { - "end": { - "column": 51, - "line": 16, - }, - "start": { - "column": 0, - "line": 16, - }, - }, - "16": { - "end": { - "column": 0, - "line": 17, - }, - "start": { - "column": 0, - "line": 17, - }, - }, - "17": { - "end": { - "column": 21, - "line": 18, - }, - "start": { - "column": 0, - "line": 18, - }, - }, - "18": { - "end": { - "column": 1, - "line": 19, - }, - "start": { - "column": 0, - "line": 19, - }, - }, - "19": { - "end": { - "column": 0, - "line": 20, - }, - "start": { - "column": 0, - "line": 20, - }, - }, - "2": { - "end": { - "column": 1, - "line": 3, - }, - "start": { - "column": 0, - "line": 3, - }, - }, - "20": { - "end": { - "column": 23, - "line": 21, - }, - "start": { - "column": 0, - "line": 21, - }, - }, - "21": { - "end": { - "column": 31, - "line": 22, - }, - "start": { - "column": 0, - "line": 22, - }, - }, - "22": { - "end": { - "column": 14, - "line": 23, - }, - "start": { - "column": 0, - "line": 23, - }, - }, - "23": { - "end": { - "column": 1, - "line": 24, - }, - "start": { - "column": 0, - "line": 24, - }, - }, - "24": { - "end": { - "column": 0, - "line": 25, - }, - "start": { - "column": 0, - "line": 25, - }, - }, - "25": { - "end": { - "column": 22, - "line": 26, - }, - "start": { - "column": 0, - "line": 26, - }, - }, - "26": { - "end": { - "column": 39, - "line": 27, - }, - "start": { - "column": 0, - "line": 27, - }, - }, - "27": { - "end": { - "column": 35, - "line": 28, - }, - "start": { - "column": 0, - "line": 28, - }, - }, - "28": { - "end": { - "column": 62, - "line": 29, - }, - "start": { - "column": 0, - "line": 29, - }, - }, - "29": { - "end": { - "column": 1, - "line": 30, - }, - "start": { - "column": 0, - "line": 30, - }, - }, - "3": { - "end": { - "column": 0, - "line": 4, - }, - "start": { - "column": 0, - "line": 4, - }, - }, - "4": { - "end": { - "column": 48, - "line": 5, - }, - "start": { - "column": 0, - "line": 5, - }, - }, - "5": { - "end": { - "column": 14, - "line": 6, - }, - "start": { - "column": 0, - "line": 6, - }, - }, - "6": { - "end": { - "column": 1, - "line": 7, - }, - "start": { - "column": 0, - "line": 7, - }, - }, - "7": { - "end": { - "column": 0, - "line": 8, - }, - "start": { - "column": 0, - "line": 8, - }, - }, - "8": { - "end": { - "column": 46, - "line": 9, - }, - "start": { - "column": 0, - "line": 9, - }, - }, - "9": { - "end": { - "column": 31, - "line": 10, - }, - "start": { - "column": 0, - "line": 10, - }, - }, - }, - }, -} -`; diff --git a/test/coverage-test/coverage-report-tests/c8.report.test.ts b/test/coverage-test/coverage-report-tests/c8.report.test.ts deleted file mode 100644 index f79c1d7e55cb..000000000000 --- a/test/coverage-test/coverage-report-tests/c8.report.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * C8 coverage provider specific test cases - */ - -import { expect, test } from 'vitest' -import { readCoverageJson } from './utils' - -test('c8 json report', async () => { - const jsonReport = await readCoverageJson() - - // If this fails, you can use "npx live-server@1.2.1 ./coverage" to see coverage report - expect(jsonReport).toMatchSnapshot() -}) - -test('ignored code is marked as covered in the report', async () => { - const functionName = 'ignoredFunction' - const filename = '/src/utils.ts' - - const coverageMap = await readCoverageJson() - const fileCoverage = coverageMap[filename] - - const [functionKey] = Object.entries(fileCoverage.fnMap).find(([, fn]) => fn.name === functionName)! - const functionCallCount = fileCoverage.f[functionKey] - - // C8 marks excluded lines as covered, instead of removing them from report completely - expect(functionCallCount).toBe(1) - - // Function should still be found from the actual sources - const utils = await import('../src/utils') - expect(utils[functionName]).toBeTypeOf('function') -}) diff --git a/test/coverage-test/package.json b/test/coverage-test/package.json index fb82f0c9c7d5..a699b16448cb 100644 --- a/test/coverage-test/package.json +++ b/test/coverage-test/package.json @@ -2,8 +2,7 @@ "name": "@vitest/test-coverage", "private": true, "scripts": { - "test": "pnpm test:c8 && pnpm test:v8 && pnpm test:istanbul && pnpm test:custom && pnpm test:browser && pnpm test:types", - "test:c8": "node ./testing.mjs --provider c8", + "test": "pnpm test:v8 && pnpm test:istanbul && pnpm test:custom && pnpm test:browser && pnpm test:types", "test:v8": "node ./testing.mjs --provider v8", "test:custom": "node ./testing.mjs --provider custom", "test:istanbul": "node ./testing.mjs --provider istanbul", @@ -14,7 +13,6 @@ "@types/istanbul-lib-coverage": "^2.0.4", "@vitejs/plugin-vue": "latest", "@vitest/browser": "workspace:*", - "@vitest/coverage-c8": "workspace:*", "@vitest/coverage-istanbul": "workspace:*", "@vitest/coverage-v8": "workspace:*", "@vue/test-utils": "latest", diff --git a/test/coverage-test/test/configuration-options.test-d.ts b/test/coverage-test/test/configuration-options.test-d.ts index 144fdc266fce..f4b0731a84e3 100644 --- a/test/coverage-test/test/configuration-options.test-d.ts +++ b/test/coverage-test/test/configuration-options.test-d.ts @@ -7,7 +7,6 @@ type Configuration = NarrowToTestConfig<(Parameters[0])> type Coverage = NonNullable test('providers, built-in', () => { - assertType({ provider: 'c8' }) assertType({ provider: 'v8' }) assertType({ provider: 'istanbul' }) @@ -23,16 +22,6 @@ test('providers, custom', () => { }) test('provider options, generic', () => { - assertType({ - provider: 'c8', - enabled: true, - include: ['string'], - watermarks: { - functions: [80, 95], - lines: [80, 95], - }, - }) - assertType({ provider: 'v8', enabled: true, @@ -53,22 +42,6 @@ test('provider options, generic', () => { }) }) -test('provider specific options, c8', () => { - assertType({ - provider: 'c8', - src: ['string'], - 100: true, - excludeNodeModules: false, - allowExternal: true, - }) - - assertType({ - provider: 'c8', - // @ts-expect-error -- Istanbul-only option is not allowed - ignoreClassMethods: ['string'], - }) -}) - test('provider specific options, v8', () => { assertType({ provider: 'v8', diff --git a/test/coverage-test/testing.mjs b/test/coverage-test/testing.mjs index e3855a6fd733..05764e17cfd0 100644 --- a/test/coverage-test/testing.mjs +++ b/test/coverage-test/testing.mjs @@ -33,7 +33,7 @@ const configs = [ // Run tests for checking coverage report contents. ['coverage-report-tests', { include: [ - ['c8', 'v8', 'istanbul'].includes(provider) && './coverage-report-tests/generic.report.test.ts', + ['v8', 'istanbul'].includes(provider) && './coverage-report-tests/generic.report.test.ts', `./coverage-report-tests/${provider}.report.test.ts`, ].filter(Boolean), coverage: { enabled: false, clean: false },