@vitest/coverage-istanbul 0.29.8 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
package/dist/provider.d.ts
CHANGED
@@ -3,42 +3,39 @@ import { BaseCoverageProvider } from 'vitest/coverage';
|
|
3
3
|
import { CoverageMap } from 'istanbul-lib-coverage';
|
4
4
|
import { Instrumenter } from 'istanbul-lib-instrument';
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
type PartialNull<T> = {
|
7
|
+
[P in keyof T]: T[P] | null;
|
8
|
+
};
|
9
|
+
|
10
|
+
interface RollupError extends RollupLog {
|
11
|
+
name?: string;
|
8
12
|
stack?: string;
|
9
13
|
watchFiles?: string[];
|
10
14
|
}
|
11
15
|
|
12
|
-
|
13
|
-
chunkName?: string;
|
14
|
-
cycle?: string[];
|
15
|
-
exportName?: string;
|
16
|
-
exporter?: string;
|
17
|
-
guess?: string;
|
18
|
-
importer?: string;
|
19
|
-
missing?: string;
|
20
|
-
modules?: string[];
|
21
|
-
names?: string[];
|
22
|
-
reexporter?: string;
|
23
|
-
source?: string;
|
24
|
-
sources?: string[];
|
25
|
-
}
|
16
|
+
type RollupWarning = RollupLog;
|
26
17
|
|
27
|
-
interface
|
18
|
+
interface RollupLog {
|
19
|
+
binding?: string;
|
20
|
+
cause?: unknown;
|
28
21
|
code?: string;
|
22
|
+
exporter?: string;
|
29
23
|
frame?: string;
|
30
24
|
hook?: string;
|
31
25
|
id?: string;
|
26
|
+
ids?: string[];
|
32
27
|
loc?: {
|
33
28
|
column: number;
|
34
29
|
file?: string;
|
35
30
|
line: number;
|
36
31
|
};
|
37
32
|
message: string;
|
38
|
-
|
33
|
+
names?: string[];
|
39
34
|
plugin?: string;
|
40
35
|
pluginCode?: string;
|
41
36
|
pos?: number;
|
37
|
+
reexporter?: string;
|
38
|
+
stack?: string;
|
42
39
|
url?: string;
|
43
40
|
}
|
44
41
|
|
@@ -47,17 +44,14 @@ interface SourceMap {
|
|
47
44
|
mappings: string;
|
48
45
|
names: string[];
|
49
46
|
sources: string[];
|
50
|
-
sourcesContent: string[];
|
47
|
+
sourcesContent: (string | null)[];
|
51
48
|
version: number;
|
52
49
|
toString(): string;
|
53
50
|
toUrl(): string;
|
54
51
|
}
|
55
52
|
|
56
|
-
type PartialNull<T> = {
|
57
|
-
[P in keyof T]: T[P] | null;
|
58
|
-
};
|
59
|
-
|
60
53
|
interface ModuleOptions {
|
54
|
+
assertions: Record<string, string>;
|
61
55
|
meta: CustomPluginOptions;
|
62
56
|
moduleSideEffects: boolean | 'no-treeshake';
|
63
57
|
syntheticNamedExports: boolean | string;
|
@@ -77,6 +71,7 @@ interface MinimalPluginContext {
|
|
77
71
|
interface EmittedAsset {
|
78
72
|
fileName?: string;
|
79
73
|
name?: string;
|
74
|
+
needsCodeReference?: boolean;
|
80
75
|
source?: string | Uint8Array;
|
81
76
|
type: 'asset';
|
82
77
|
}
|
@@ -93,10 +88,6 @@ interface EmittedChunk {
|
|
93
88
|
|
94
89
|
type EmittedFile = EmittedAsset | EmittedChunk;
|
95
90
|
|
96
|
-
type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
97
|
-
|
98
|
-
type EmitChunk = (id: string, options?: { name?: string }) => string;
|
99
|
-
|
100
91
|
type EmitFile = (emittedFile: EmittedFile) => string;
|
101
92
|
|
102
93
|
interface ModuleInfo extends ModuleOptions {
|
@@ -105,6 +96,8 @@ interface ModuleInfo extends ModuleOptions {
|
|
105
96
|
dynamicImporters: readonly string[];
|
106
97
|
dynamicallyImportedIdResolutions: readonly ResolvedId[];
|
107
98
|
dynamicallyImportedIds: readonly string[];
|
99
|
+
exportedBindings: Record<string, string[]> | null;
|
100
|
+
exports: string[] | null;
|
108
101
|
hasDefaultExport: boolean | null;
|
109
102
|
/** @deprecated Use `moduleSideEffects` instead */
|
110
103
|
hasModuleSideEffects: boolean | 'no-treeshake';
|
@@ -128,22 +121,12 @@ interface CustomPluginOptions {
|
|
128
121
|
interface PluginContext extends MinimalPluginContext {
|
129
122
|
addWatchFile: (id: string) => void;
|
130
123
|
cache: PluginCache;
|
131
|
-
/** @deprecated Use `this.emitFile` instead */
|
132
|
-
emitAsset: EmitAsset;
|
133
|
-
/** @deprecated Use `this.emitFile` instead */
|
134
|
-
emitChunk: EmitChunk;
|
135
124
|
emitFile: EmitFile;
|
136
|
-
error: (
|
137
|
-
/** @deprecated Use `this.getFileName` instead */
|
138
|
-
getAssetFileName: (assetReferenceId: string) => string;
|
139
|
-
/** @deprecated Use `this.getFileName` instead */
|
140
|
-
getChunkFileName: (chunkReferenceId: string) => string;
|
125
|
+
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
141
126
|
getFileName: (fileReferenceId: string) => string;
|
142
127
|
getModuleIds: () => IterableIterator<string>;
|
143
128
|
getModuleInfo: GetModuleInfo;
|
144
129
|
getWatchFiles: () => string[];
|
145
|
-
/** @deprecated Use `this.resolve` instead */
|
146
|
-
isExternal: IsExternal;
|
147
130
|
load: (
|
148
131
|
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
|
149
132
|
) => Promise<ModuleInfo>;
|
@@ -153,10 +136,13 @@ interface PluginContext extends MinimalPluginContext {
|
|
153
136
|
resolve: (
|
154
137
|
source: string,
|
155
138
|
importer?: string,
|
156
|
-
options?: {
|
139
|
+
options?: {
|
140
|
+
assertions?: Record<string, string>;
|
141
|
+
custom?: CustomPluginOptions;
|
142
|
+
isEntry?: boolean;
|
143
|
+
skipSelf?: boolean;
|
144
|
+
}
|
157
145
|
) => Promise<ResolvedId | null>;
|
158
|
-
/** @deprecated Use `this.resolve` instead */
|
159
|
-
resolveId: (source: string, importer?: string) => Promise<string | null>;
|
160
146
|
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
161
147
|
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
162
148
|
}
|
@@ -169,14 +155,9 @@ interface PluginContextMeta {
|
|
169
155
|
interface ResolvedId extends ModuleOptions {
|
170
156
|
external: boolean | 'absolute';
|
171
157
|
id: string;
|
158
|
+
resolvedBy: string;
|
172
159
|
}
|
173
160
|
|
174
|
-
type IsExternal = (
|
175
|
-
source: string,
|
176
|
-
importer: string | undefined,
|
177
|
-
isResolved: boolean
|
178
|
-
) => boolean;
|
179
|
-
|
180
161
|
interface TransformPluginContext extends PluginContext {
|
181
162
|
getCombinedSourcemap: () => SourceMap;
|
182
163
|
}
|
package/dist/provider.js
CHANGED
@@ -7,7 +7,7 @@ import libCoverage from 'istanbul-lib-coverage';
|
|
7
7
|
import libSourceMaps from 'istanbul-lib-source-maps';
|
8
8
|
import { createInstrumenter } from 'istanbul-lib-instrument';
|
9
9
|
import _TestExclude from 'test-exclude';
|
10
|
-
import { C as COVERAGE_STORE_KEY } from './constants-
|
10
|
+
import { C as COVERAGE_STORE_KEY } from './constants-758a8358.js';
|
11
11
|
|
12
12
|
function normalizeWindowsPath(input = "") {
|
13
13
|
if (!input || !input.includes("\\")) {
|
@@ -120,6 +120,12 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
|
|
120
120
|
constructor() {
|
121
121
|
super(...arguments);
|
122
122
|
this.name = "istanbul";
|
123
|
+
/**
|
124
|
+
* Coverage objects collected from workers.
|
125
|
+
* Some istanbul utilizers write these into file system instead of storing in memory.
|
126
|
+
* If storing in memory causes issues, we can simply write these into fs in `onAfterSuiteRun`
|
127
|
+
* and read them back when merging coverage objects in `onAfterAllFilesRun`.
|
128
|
+
*/
|
123
129
|
this.coverages = [];
|
124
130
|
}
|
125
131
|
initialize(ctx) {
|
@@ -127,7 +133,9 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
|
|
127
133
|
this.ctx = ctx;
|
128
134
|
this.options = {
|
129
135
|
...coverageConfigDefaults,
|
136
|
+
// User's options
|
130
137
|
...config,
|
138
|
+
// Resolved fields
|
131
139
|
provider: "istanbul",
|
132
140
|
reportsDirectory: resolve(ctx.config.root, config.reportsDirectory || coverageConfigDefaults.reportsDirectory),
|
133
141
|
reporter: this.resolveReporters(config.reporter || coverageConfigDefaults.reporter)
|
@@ -138,6 +146,7 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
|
|
138
146
|
esModules: true,
|
139
147
|
compact: false,
|
140
148
|
coverageVariable: COVERAGE_STORE_KEY,
|
149
|
+
// @ts-expect-error missing type
|
141
150
|
coverageGlobalScope: "globalThis",
|
142
151
|
coverageGlobalScopeFunc: false,
|
143
152
|
ignoreClassMethods: this.options.ignoreClassMethods
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/coverage-istanbul",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.30.0",
|
5
5
|
"description": "Istanbul coverage provider for Vitest",
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
7
7
|
"license": "MIT",
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"dist"
|
38
38
|
],
|
39
39
|
"peerDependencies": {
|
40
|
-
"vitest": ">=0.
|
40
|
+
"vitest": ">=0.30.0 <1"
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
43
|
"istanbul-lib-coverage": "^3.2.0",
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"@types/istanbul-lib-source-maps": "^4.0.1",
|
55
55
|
"@types/istanbul-reports": "^3.0.1",
|
56
56
|
"pathe": "^1.1.0",
|
57
|
-
"vitest": "0.
|
57
|
+
"vitest": "0.30.0"
|
58
58
|
},
|
59
59
|
"scripts": {
|
60
60
|
"build": "rimraf dist && rollup -c",
|
File without changes
|