|
1 | | -import type { CoverageMap } from 'istanbul-lib-coverage' |
2 | | -import type { Instrumenter } from 'istanbul-lib-instrument' |
| 1 | +import type { CoverageMap } from '@vitest/istanbul-lib-coverage' |
| 2 | +import type { Instrumenter } from '@vitest/istanbul-lib-instrument' |
3 | 3 | import type { ProxifiedModule } from 'magicast' |
4 | 4 | import type { CoverageProvider, ReportContext, Vite, Vitest } from 'vitest/node' |
5 | 5 | import { existsSync, promises as fs } from 'node:fs' |
6 | | -// @ts-expect-error missing types |
7 | | -import { defaults as istanbulDefaults } from '@istanbuljs/schema' |
8 | 6 | import { addMapping, GenMapping, toEncodedMap } from '@jridgewell/gen-mapping' |
9 | 7 | import { eachMapping, TraceMap } from '@jridgewell/trace-mapping' |
10 | | -import libCoverage from 'istanbul-lib-coverage' |
11 | | -import { createInstrumenter } from 'istanbul-lib-instrument' |
12 | | -import libReport from 'istanbul-lib-report' |
13 | | -import libSourceMaps from 'istanbul-lib-source-maps' |
14 | | -import reports from 'istanbul-reports' |
| 8 | +import * as libCoverage from '@vitest/istanbul-lib-coverage' |
| 9 | +import { createInstrumenter } from '@vitest/istanbul-lib-instrument' |
| 10 | +import * as libReport from '@vitest/istanbul-lib-report' |
| 11 | +import * as libSourceMaps from '@vitest/istanbul-lib-source-maps' |
15 | 12 | import { parseModule } from 'magicast' |
16 | 13 | import { createDebug } from 'obug' |
17 | 14 | import c from 'tinyrainbow' |
@@ -58,16 +55,6 @@ export class IstanbulCoverageProvider extends BaseCoverageProvider implements Co |
58 | 55 | coverageGlobalScope: 'globalThis', |
59 | 56 | coverageGlobalScopeFunc: false, |
60 | 57 | ignoreClassMethods: this.options.ignoreClassMethods, |
61 | | - parserPlugins: [ |
62 | | - ...istanbulDefaults.instrumenter.parserPlugins, |
63 | | - ['importAttributes', { deprecatedAssertSyntax: true }], |
64 | | - ], |
65 | | - generatorOpts: { |
66 | | - // @ts-expect-error missing type |
67 | | - importAttributesKeyword: 'with', |
68 | | - }, |
69 | | - |
70 | | - // Custom option from the patched istanbul-lib-instrument: https://github.com/istanbuljs/istanbuljs/pull/835 |
71 | 58 | ignoreLines: true, |
72 | 59 | }) |
73 | 60 | } |
@@ -206,13 +193,14 @@ export class IstanbulCoverageProvider extends BaseCoverageProvider implements Co |
206 | 193 |
|
207 | 194 | for (const reporter of this.options.reporter) { |
208 | 195 | // Type assertion required for custom reporters |
209 | | - reports |
210 | | - .create(reporter[0] as Parameters<typeof reports.create>[0], { |
| 196 | + const reportInstance = await libReport |
| 197 | + .createAsync(reporter[0] as Parameters<typeof libReport.create>[0], { |
211 | 198 | skipFull: this.options.skipFull, |
212 | 199 | projectRoot: this.ctx.config.root, |
213 | 200 | ...reporter[1], |
214 | 201 | }) |
215 | | - .execute(context) |
| 202 | + |
| 203 | + reportInstance.execute(context) |
216 | 204 | } |
217 | 205 |
|
218 | 206 | if (this.options.thresholds) { |
|
0 commit comments