@vitest/coverage-v8 2.1.3 → 2.1.5
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/browser.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +141 -141
- package/package.json +10 -10
package/dist/browser.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { V8CoverageProvider } from './provider.js';
|
2
2
|
import 'magicast';
|
3
3
|
import 'istanbul-lib-coverage';
|
4
|
+
import 'vitest/node';
|
4
5
|
import 'test-exclude';
|
5
6
|
import 'vitest/coverage';
|
6
|
-
import 'vitest/node';
|
7
7
|
|
8
8
|
declare const _default: {
|
9
9
|
startCoverage(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import { Profiler } from 'node:inspector';
|
2
1
|
import { V8CoverageProvider } from './provider.js';
|
2
|
+
import { Profiler } from 'node:inspector';
|
3
3
|
import 'magicast';
|
4
4
|
import 'istanbul-lib-coverage';
|
5
|
+
import 'vitest/node';
|
5
6
|
import 'test-exclude';
|
6
7
|
import 'vitest/coverage';
|
7
|
-
import 'vitest/node';
|
8
8
|
|
9
9
|
declare const _default: {
|
10
10
|
startCoverage(): void;
|
package/dist/provider.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as magicast from 'magicast';
|
2
|
-
import
|
2
|
+
import { CoverageMap } from 'istanbul-lib-coverage';
|
3
|
+
import { ResolvedCoverageOptions, CoverageProvider, Vitest, ReportContext } from 'vitest/node';
|
3
4
|
import TestExclude from 'test-exclude';
|
4
5
|
import { BaseCoverageProvider } from 'vitest/coverage';
|
5
|
-
import { ResolvedCoverageOptions, CoverageProvider, Vitest, ReportContext } from 'vitest/node';
|
6
6
|
|
7
7
|
declare class V8CoverageProvider extends BaseCoverageProvider<ResolvedCoverageOptions<'v8'>> implements CoverageProvider {
|
8
8
|
name: "v8";
|
9
9
|
version: string;
|
10
10
|
testExclude: InstanceType<typeof TestExclude>;
|
11
11
|
initialize(ctx: Vitest): void;
|
12
|
-
createCoverageMap():
|
12
|
+
createCoverageMap(): CoverageMap;
|
13
13
|
generateCoverage({ allTestsRun }: ReportContext): Promise<CoverageMap>;
|
14
14
|
generateReports(coverageMap: CoverageMap, allTestsRun?: boolean): Promise<void>;
|
15
15
|
parseConfigModule(configFilePath: string): Promise<magicast.ProxifiedModule<any>>;
|
package/dist/provider.js
CHANGED
@@ -1,25 +1,152 @@
|
|
1
|
-
import { pathToFileURL, fileURLToPath } from 'node:url';
|
2
1
|
import { promises } from 'node:fs';
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import require$$3 from 'path';
|
6
|
-
import require$$4 from 'url';
|
7
|
-
import require$$9 from 'fs';
|
8
|
-
import require$$11 from 'module';
|
2
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
3
|
+
import remapping from '@ampproject/remapping';
|
9
4
|
import { mergeProcessCovs } from '@bcoe/v8-coverage';
|
5
|
+
import createDebug from 'debug';
|
10
6
|
import libCoverage from 'istanbul-lib-coverage';
|
11
7
|
import libReport from 'istanbul-lib-report';
|
12
8
|
import libSourceMaps from 'istanbul-lib-source-maps';
|
13
9
|
import reports from 'istanbul-reports';
|
14
|
-
import { provider } from 'std-env';
|
15
|
-
import c from 'tinyrainbow';
|
16
|
-
import createDebug from 'debug';
|
17
10
|
import MagicString from 'magic-string';
|
11
|
+
import { parseModule } from 'magicast';
|
12
|
+
import { provider } from 'std-env';
|
18
13
|
import TestExclude from 'test-exclude';
|
19
|
-
import
|
20
|
-
import
|
14
|
+
import c from 'tinyrainbow';
|
15
|
+
import require$$0 from 'assert';
|
16
|
+
import require$$2 from 'util';
|
17
|
+
import require$$3 from 'path';
|
18
|
+
import require$$4 from 'url';
|
19
|
+
import require$$9 from 'fs';
|
20
|
+
import require$$11 from 'module';
|
21
21
|
import { builtinModules } from 'node:module';
|
22
|
-
import {
|
22
|
+
import { BaseCoverageProvider } from 'vitest/coverage';
|
23
|
+
|
24
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
25
|
+
function normalizeWindowsPath(input = "") {
|
26
|
+
if (!input) {
|
27
|
+
return input;
|
28
|
+
}
|
29
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
30
|
+
}
|
31
|
+
|
32
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
33
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
34
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
35
|
+
const normalize = function(path) {
|
36
|
+
if (path.length === 0) {
|
37
|
+
return ".";
|
38
|
+
}
|
39
|
+
path = normalizeWindowsPath(path);
|
40
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
41
|
+
const isPathAbsolute = isAbsolute(path);
|
42
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
43
|
+
path = normalizeString(path, !isPathAbsolute);
|
44
|
+
if (path.length === 0) {
|
45
|
+
if (isPathAbsolute) {
|
46
|
+
return "/";
|
47
|
+
}
|
48
|
+
return trailingSeparator ? "./" : ".";
|
49
|
+
}
|
50
|
+
if (trailingSeparator) {
|
51
|
+
path += "/";
|
52
|
+
}
|
53
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
54
|
+
path += "/";
|
55
|
+
}
|
56
|
+
if (isUNCPath) {
|
57
|
+
if (!isPathAbsolute) {
|
58
|
+
return `//./${path}`;
|
59
|
+
}
|
60
|
+
return `//${path}`;
|
61
|
+
}
|
62
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
63
|
+
};
|
64
|
+
function cwd() {
|
65
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
66
|
+
return process.cwd().replace(/\\/g, "/");
|
67
|
+
}
|
68
|
+
return "/";
|
69
|
+
}
|
70
|
+
const resolve = function(...arguments_) {
|
71
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
72
|
+
let resolvedPath = "";
|
73
|
+
let resolvedAbsolute = false;
|
74
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
75
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
76
|
+
if (!path || path.length === 0) {
|
77
|
+
continue;
|
78
|
+
}
|
79
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
80
|
+
resolvedAbsolute = isAbsolute(path);
|
81
|
+
}
|
82
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
83
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
84
|
+
return `/${resolvedPath}`;
|
85
|
+
}
|
86
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
87
|
+
};
|
88
|
+
function normalizeString(path, allowAboveRoot) {
|
89
|
+
let res = "";
|
90
|
+
let lastSegmentLength = 0;
|
91
|
+
let lastSlash = -1;
|
92
|
+
let dots = 0;
|
93
|
+
let char = null;
|
94
|
+
for (let index = 0; index <= path.length; ++index) {
|
95
|
+
if (index < path.length) {
|
96
|
+
char = path[index];
|
97
|
+
} else if (char === "/") {
|
98
|
+
break;
|
99
|
+
} else {
|
100
|
+
char = "/";
|
101
|
+
}
|
102
|
+
if (char === "/") {
|
103
|
+
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
|
104
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
105
|
+
if (res.length > 2) {
|
106
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
107
|
+
if (lastSlashIndex === -1) {
|
108
|
+
res = "";
|
109
|
+
lastSegmentLength = 0;
|
110
|
+
} else {
|
111
|
+
res = res.slice(0, lastSlashIndex);
|
112
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
113
|
+
}
|
114
|
+
lastSlash = index;
|
115
|
+
dots = 0;
|
116
|
+
continue;
|
117
|
+
} else if (res.length > 0) {
|
118
|
+
res = "";
|
119
|
+
lastSegmentLength = 0;
|
120
|
+
lastSlash = index;
|
121
|
+
dots = 0;
|
122
|
+
continue;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
if (allowAboveRoot) {
|
126
|
+
res += res.length > 0 ? "/.." : "..";
|
127
|
+
lastSegmentLength = 2;
|
128
|
+
}
|
129
|
+
} else {
|
130
|
+
if (res.length > 0) {
|
131
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
132
|
+
} else {
|
133
|
+
res = path.slice(lastSlash + 1, index);
|
134
|
+
}
|
135
|
+
lastSegmentLength = index - lastSlash - 1;
|
136
|
+
}
|
137
|
+
lastSlash = index;
|
138
|
+
dots = 0;
|
139
|
+
} else if (char === "." && dots !== -1) {
|
140
|
+
++dots;
|
141
|
+
} else {
|
142
|
+
dots = -1;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
return res;
|
146
|
+
}
|
147
|
+
const isAbsolute = function(p) {
|
148
|
+
return _IS_ABSOLUTE_RE.test(p);
|
149
|
+
};
|
23
150
|
|
24
151
|
function getDefaultExportFromCjs (x) {
|
25
152
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
@@ -2388,133 +2515,6 @@ function requireV8ToIstanbul () {
|
|
2388
2515
|
var v8ToIstanbulExports = requireV8ToIstanbul();
|
2389
2516
|
var v8ToIstanbul = /*@__PURE__*/getDefaultExportFromCjs(v8ToIstanbulExports);
|
2390
2517
|
|
2391
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
2392
|
-
function normalizeWindowsPath(input = "") {
|
2393
|
-
if (!input) {
|
2394
|
-
return input;
|
2395
|
-
}
|
2396
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
2397
|
-
}
|
2398
|
-
|
2399
|
-
const _UNC_REGEX = /^[/\\]{2}/;
|
2400
|
-
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
2401
|
-
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
2402
|
-
const normalize = function(path) {
|
2403
|
-
if (path.length === 0) {
|
2404
|
-
return ".";
|
2405
|
-
}
|
2406
|
-
path = normalizeWindowsPath(path);
|
2407
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
2408
|
-
const isPathAbsolute = isAbsolute(path);
|
2409
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
2410
|
-
path = normalizeString(path, !isPathAbsolute);
|
2411
|
-
if (path.length === 0) {
|
2412
|
-
if (isPathAbsolute) {
|
2413
|
-
return "/";
|
2414
|
-
}
|
2415
|
-
return trailingSeparator ? "./" : ".";
|
2416
|
-
}
|
2417
|
-
if (trailingSeparator) {
|
2418
|
-
path += "/";
|
2419
|
-
}
|
2420
|
-
if (_DRIVE_LETTER_RE.test(path)) {
|
2421
|
-
path += "/";
|
2422
|
-
}
|
2423
|
-
if (isUNCPath) {
|
2424
|
-
if (!isPathAbsolute) {
|
2425
|
-
return `//./${path}`;
|
2426
|
-
}
|
2427
|
-
return `//${path}`;
|
2428
|
-
}
|
2429
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
2430
|
-
};
|
2431
|
-
function cwd() {
|
2432
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
2433
|
-
return process.cwd().replace(/\\/g, "/");
|
2434
|
-
}
|
2435
|
-
return "/";
|
2436
|
-
}
|
2437
|
-
const resolve = function(...arguments_) {
|
2438
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
2439
|
-
let resolvedPath = "";
|
2440
|
-
let resolvedAbsolute = false;
|
2441
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
2442
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
2443
|
-
if (!path || path.length === 0) {
|
2444
|
-
continue;
|
2445
|
-
}
|
2446
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
2447
|
-
resolvedAbsolute = isAbsolute(path);
|
2448
|
-
}
|
2449
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
2450
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
2451
|
-
return `/${resolvedPath}`;
|
2452
|
-
}
|
2453
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
2454
|
-
};
|
2455
|
-
function normalizeString(path, allowAboveRoot) {
|
2456
|
-
let res = "";
|
2457
|
-
let lastSegmentLength = 0;
|
2458
|
-
let lastSlash = -1;
|
2459
|
-
let dots = 0;
|
2460
|
-
let char = null;
|
2461
|
-
for (let index = 0; index <= path.length; ++index) {
|
2462
|
-
if (index < path.length) {
|
2463
|
-
char = path[index];
|
2464
|
-
} else if (char === "/") {
|
2465
|
-
break;
|
2466
|
-
} else {
|
2467
|
-
char = "/";
|
2468
|
-
}
|
2469
|
-
if (char === "/") {
|
2470
|
-
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
|
2471
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
2472
|
-
if (res.length > 2) {
|
2473
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
2474
|
-
if (lastSlashIndex === -1) {
|
2475
|
-
res = "";
|
2476
|
-
lastSegmentLength = 0;
|
2477
|
-
} else {
|
2478
|
-
res = res.slice(0, lastSlashIndex);
|
2479
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
2480
|
-
}
|
2481
|
-
lastSlash = index;
|
2482
|
-
dots = 0;
|
2483
|
-
continue;
|
2484
|
-
} else if (res.length > 0) {
|
2485
|
-
res = "";
|
2486
|
-
lastSegmentLength = 0;
|
2487
|
-
lastSlash = index;
|
2488
|
-
dots = 0;
|
2489
|
-
continue;
|
2490
|
-
}
|
2491
|
-
}
|
2492
|
-
if (allowAboveRoot) {
|
2493
|
-
res += res.length > 0 ? "/.." : "..";
|
2494
|
-
lastSegmentLength = 2;
|
2495
|
-
}
|
2496
|
-
} else {
|
2497
|
-
if (res.length > 0) {
|
2498
|
-
res += `/${path.slice(lastSlash + 1, index)}`;
|
2499
|
-
} else {
|
2500
|
-
res = path.slice(lastSlash + 1, index);
|
2501
|
-
}
|
2502
|
-
lastSegmentLength = index - lastSlash - 1;
|
2503
|
-
}
|
2504
|
-
lastSlash = index;
|
2505
|
-
dots = 0;
|
2506
|
-
} else if (char === "." && dots !== -1) {
|
2507
|
-
++dots;
|
2508
|
-
} else {
|
2509
|
-
dots = -1;
|
2510
|
-
}
|
2511
|
-
}
|
2512
|
-
return res;
|
2513
|
-
}
|
2514
|
-
const isAbsolute = function(p) {
|
2515
|
-
return _IS_ABSOLUTE_RE.test(p);
|
2516
|
-
};
|
2517
|
-
|
2518
2518
|
const isWindows = process.platform === "win32";
|
2519
2519
|
const drive = isWindows ? process.cwd()[0] : null;
|
2520
2520
|
drive ? drive === drive.toUpperCase() ? drive.toLowerCase() : drive.toUpperCase() : null;
|
@@ -2539,7 +2539,7 @@ function cleanUrl(url) {
|
|
2539
2539
|
"wasi"
|
2540
2540
|
]);
|
2541
2541
|
|
2542
|
-
var version = "2.1.
|
2542
|
+
var version = "2.1.5";
|
2543
2543
|
|
2544
2544
|
const WRAPPER_LENGTH = 185;
|
2545
2545
|
const VITE_EXPORTS_LINE_PATTERN = /Object\.defineProperty\(__vite_ssr_exports__.*\n/g;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/coverage-v8",
|
3
3
|
"type": "module",
|
4
|
-
"version": "2.1.
|
4
|
+
"version": "2.1.5",
|
5
5
|
"description": "V8 coverage provider for Vitest",
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
7
7
|
"license": "MIT",
|
@@ -41,8 +41,8 @@
|
|
41
41
|
"dist"
|
42
42
|
],
|
43
43
|
"peerDependencies": {
|
44
|
-
"@vitest/browser": "2.1.
|
45
|
-
"vitest": "2.1.
|
44
|
+
"@vitest/browser": "2.1.5",
|
45
|
+
"vitest": "2.1.5"
|
46
46
|
},
|
47
47
|
"peerDependenciesMeta": {
|
48
48
|
"@vitest/browser": {
|
@@ -52,14 +52,14 @@
|
|
52
52
|
"dependencies": {
|
53
53
|
"@ampproject/remapping": "^2.3.0",
|
54
54
|
"@bcoe/v8-coverage": "^0.2.3",
|
55
|
-
"debug": "^4.3.
|
55
|
+
"debug": "^4.3.7",
|
56
56
|
"istanbul-lib-coverage": "^3.2.2",
|
57
57
|
"istanbul-lib-report": "^3.0.1",
|
58
58
|
"istanbul-lib-source-maps": "^5.0.6",
|
59
59
|
"istanbul-reports": "^3.1.7",
|
60
|
-
"magic-string": "^0.30.
|
61
|
-
"magicast": "^0.3.
|
62
|
-
"std-env": "^3.
|
60
|
+
"magic-string": "^0.30.12",
|
61
|
+
"magicast": "^0.3.5",
|
62
|
+
"std-env": "^3.8.0",
|
63
63
|
"test-exclude": "^7.0.1",
|
64
64
|
"tinyrainbow": "^1.2.0"
|
65
65
|
},
|
@@ -72,9 +72,9 @@
|
|
72
72
|
"@types/test-exclude": "^6.0.2",
|
73
73
|
"pathe": "^1.1.2",
|
74
74
|
"v8-to-istanbul": "^9.3.0",
|
75
|
-
"@vitest/browser": "2.1.
|
76
|
-
"vite-node": "2.1.
|
77
|
-
"vitest": "2.1.
|
75
|
+
"@vitest/browser": "2.1.5",
|
76
|
+
"vite-node": "2.1.5",
|
77
|
+
"vitest": "2.1.5"
|
78
78
|
},
|
79
79
|
"scripts": {
|
80
80
|
"build": "rimraf dist && rollup -c",
|