vitest 0.22.1 → 0.23.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/LICENSE.md +29 -29
- package/dist/browser.d.ts +5 -4
- package/dist/browser.mjs +11 -9
- package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.5fc06d1d.mjs} +90 -87
- package/dist/{chunk-constants.71e8a211.mjs → chunk-constants.6196597b.mjs} +0 -0
- package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
- package/dist/{chunk-install-pkg.3aa3eae6.mjs → chunk-install-pkg.e081fc1b.mjs} +3 -3
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ef598c23.mjs} +6 -7
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.0d86eaa5.mjs} +26 -5
- package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.6f289b0a.mjs} +18 -12
- package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -173
- package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.ed9b4f70.mjs} +206 -75
- package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.fc76f21d.mjs} +17 -10
- package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
- package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -5
- package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.74ebe3d5.mjs} +55 -13
- package/dist/{chunk-vite-node-debug.536c4c5b.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.41bf722e.mjs} +483 -197
- package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.68573626.mjs} +24 -40
- package/dist/cli-wrapper.mjs +21 -17
- package/dist/cli.mjs +23 -15
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +4 -3
- package/dist/config.mjs +2 -2
- package/dist/entry.mjs +19 -14
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-fe52f84b.d.ts → global-ea084c9f.d.ts} +135 -19
- package/dist/{index-ea17aa0c.d.ts → index-5f09f4d0.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +6 -7
- package/dist/loader.mjs +3 -4
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +14 -12
- package/dist/suite.mjs +5 -6
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/{vendor-index.9d9196cc.mjs → vendor-index.13e3bda3.mjs} +0 -0
- package/dist/{vendor-index.fbec8a81.mjs → vendor-index.4aeeb598.mjs} +2 -2
- package/dist/{vendor-index.2ae8040a.mjs → vendor-index.62ce5c33.mjs} +0 -0
- package/dist/{vendor-index.29636037.mjs → vendor-index.731a22f2.mjs} +0 -0
- package/dist/worker.mjs +17 -15
- package/package.json +17 -10
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
|
@@ -4,7 +4,7 @@ import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'u
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import { format, inspect } from 'util';
|
|
7
|
-
import { a as resolve$1 } from './chunk-constants.
|
|
7
|
+
import { a as resolve$1 } from './chunk-constants.6196597b.mjs';
|
|
8
8
|
|
|
9
9
|
// This file was generated. Do not modify manually!
|
|
10
10
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
@@ -5587,50 +5587,22 @@ function joinURL(base, ...input) {
|
|
|
5587
5587
|
return url;
|
|
5588
5588
|
}
|
|
5589
5589
|
|
|
5590
|
-
function normalizeWindowsPath$1(input = "") {
|
|
5591
|
-
if (!input || !input.includes("\\")) {
|
|
5592
|
-
return input;
|
|
5593
|
-
}
|
|
5594
|
-
return input.replace(/\\/g, "/");
|
|
5595
|
-
}
|
|
5596
|
-
const _IS_ABSOLUTE_RE$1 = /^[\\/](?![\\/])|^[\\/]{2}(?!\.)|^[a-zA-Z]:[\\/]/;
|
|
5597
|
-
const isAbsolute$1 = function(p) {
|
|
5598
|
-
return _IS_ABSOLUTE_RE$1.test(p);
|
|
5599
|
-
};
|
|
5600
|
-
const _EXTNAME_RE = /(?<!^)\.[^/.]+$/;
|
|
5601
|
-
const extname = function(p) {
|
|
5602
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath$1(p));
|
|
5603
|
-
return match && match[0] || "";
|
|
5604
|
-
};
|
|
5605
|
-
|
|
5606
|
-
/*---------------------------------------------------------------------------------------------
|
|
5607
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5608
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5609
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5610
|
-
var ParseOptions;
|
|
5611
|
-
(function (ParseOptions) {
|
|
5612
|
-
ParseOptions.DEFAULT = {
|
|
5613
|
-
allowTrailingComma: false
|
|
5614
|
-
};
|
|
5615
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
5616
|
-
|
|
5617
5590
|
function normalizeWindowsPath(input = "") {
|
|
5618
|
-
if (!input.includes("\\")) {
|
|
5591
|
+
if (!input || !input.includes("\\")) {
|
|
5619
5592
|
return input;
|
|
5620
5593
|
}
|
|
5621
5594
|
return input.replace(/\\/g, "/");
|
|
5622
5595
|
}
|
|
5623
5596
|
|
|
5624
|
-
const _UNC_REGEX = /^[
|
|
5625
|
-
const
|
|
5626
|
-
const
|
|
5597
|
+
const _UNC_REGEX = /^[\\/]{2}/;
|
|
5598
|
+
const _IS_ABSOLUTE_RE = /^[\\/](?![\\/])|^[\\/]{2}(?!\.)|^[a-zA-Z]:[\\/]/;
|
|
5599
|
+
const _DRIVE_LETTER_RE = /^[a-zA-Z]:$/;
|
|
5627
5600
|
const normalize = function(path) {
|
|
5628
5601
|
if (path.length === 0) {
|
|
5629
5602
|
return ".";
|
|
5630
5603
|
}
|
|
5631
5604
|
path = normalizeWindowsPath(path);
|
|
5632
5605
|
const isUNCPath = path.match(_UNC_REGEX);
|
|
5633
|
-
const hasUNCDrive = isUNCPath && path.match(_UNC_DRIVE_REGEX);
|
|
5634
5606
|
const isPathAbsolute = isAbsolute(path);
|
|
5635
5607
|
const trailingSeparator = path[path.length - 1] === "/";
|
|
5636
5608
|
path = normalizeString(path, !isPathAbsolute);
|
|
@@ -5643,8 +5615,11 @@ const normalize = function(path) {
|
|
|
5643
5615
|
if (trailingSeparator) {
|
|
5644
5616
|
path += "/";
|
|
5645
5617
|
}
|
|
5618
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
5619
|
+
path += "/";
|
|
5620
|
+
}
|
|
5646
5621
|
if (isUNCPath) {
|
|
5647
|
-
if (
|
|
5622
|
+
if (!isPathAbsolute) {
|
|
5648
5623
|
return `//./${path}`;
|
|
5649
5624
|
}
|
|
5650
5625
|
return `//${path}`;
|
|
@@ -5658,7 +5633,7 @@ const join = function(...args) {
|
|
|
5658
5633
|
let joined;
|
|
5659
5634
|
for (let i = 0; i < args.length; ++i) {
|
|
5660
5635
|
const arg = args[i];
|
|
5661
|
-
if (arg.length > 0) {
|
|
5636
|
+
if (arg && arg.length > 0) {
|
|
5662
5637
|
if (joined === void 0) {
|
|
5663
5638
|
joined = arg;
|
|
5664
5639
|
} else {
|
|
@@ -5676,8 +5651,8 @@ const resolve = function(...args) {
|
|
|
5676
5651
|
let resolvedPath = "";
|
|
5677
5652
|
let resolvedAbsolute = false;
|
|
5678
5653
|
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
5679
|
-
const path = i >= 0 ? args[i] : process.cwd();
|
|
5680
|
-
if (path.length === 0) {
|
|
5654
|
+
const path = i >= 0 ? args[i] : process.cwd().replace(/\\/g, "/");
|
|
5655
|
+
if (!path || path.length === 0) {
|
|
5681
5656
|
continue;
|
|
5682
5657
|
}
|
|
5683
5658
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
@@ -5751,6 +5726,11 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
5751
5726
|
const isAbsolute = function(p) {
|
|
5752
5727
|
return _IS_ABSOLUTE_RE.test(p);
|
|
5753
5728
|
};
|
|
5729
|
+
const _EXTNAME_RE = /.(\.[^/.]+)$/;
|
|
5730
|
+
const extname = function(p) {
|
|
5731
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
5732
|
+
return match && match[1] || "";
|
|
5733
|
+
};
|
|
5754
5734
|
|
|
5755
5735
|
const defaultFindOptions = {
|
|
5756
5736
|
startingFrom: ".",
|
|
@@ -5774,8 +5754,9 @@ async function findNearestFile(filename, _options = {}) {
|
|
|
5774
5754
|
segments[0] = "/" + segments[0];
|
|
5775
5755
|
}
|
|
5776
5756
|
let root = segments.findIndex((r) => r.match(options.rootPattern));
|
|
5777
|
-
if (root === -1)
|
|
5757
|
+
if (root === -1) {
|
|
5778
5758
|
root = 0;
|
|
5759
|
+
}
|
|
5779
5760
|
for (let i = segments.length; i > root; i--) {
|
|
5780
5761
|
const filePath = join(...segments.slice(0, i), filename);
|
|
5781
5762
|
if (await options.test(filePath)) {
|
|
@@ -6777,7 +6758,7 @@ function _resolve(id, opts = {}) {
|
|
|
6777
6758
|
if (BUILTIN_MODULES.has(id)) {
|
|
6778
6759
|
return "node:" + id;
|
|
6779
6760
|
}
|
|
6780
|
-
if (isAbsolute
|
|
6761
|
+
if (isAbsolute(id) && existsSync(id)) {
|
|
6781
6762
|
const realPath2 = realpathSync(fileURLToPath(id));
|
|
6782
6763
|
return pathToFileURL(realPath2).toString();
|
|
6783
6764
|
}
|
|
@@ -6877,6 +6858,9 @@ const isWindows = process.platform === "win32";
|
|
|
6877
6858
|
function slash(str) {
|
|
6878
6859
|
return str.replace(/\\/g, "/");
|
|
6879
6860
|
}
|
|
6861
|
+
function getType(value) {
|
|
6862
|
+
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
6863
|
+
}
|
|
6880
6864
|
function mergeSlashes(str) {
|
|
6881
6865
|
return str.replace(/\/\//g, "/");
|
|
6882
6866
|
}
|
|
@@ -6918,4 +6902,4 @@ function toArray(array) {
|
|
|
6918
6902
|
return [array];
|
|
6919
6903
|
}
|
|
6920
6904
|
|
|
6921
|
-
export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, hasCJSSyntax as h, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
|
6905
|
+
export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, getType as g, hasCJSSyntax as h, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
package/dist/cli-wrapper.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.
|
|
3
|
-
import { e as execa } from './vendor-index.
|
|
2
|
+
import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.6196597b.mjs';
|
|
3
|
+
import { e as execa } from './vendor-index.4aeeb598.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'buffer';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
import 'process';
|
|
9
|
-
import './vendor-index.
|
|
9
|
+
import './vendor-index.62ce5c33.mjs';
|
|
10
10
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'os';
|
|
15
|
-
import './vendor-index.
|
|
15
|
+
import './vendor-index.731a22f2.mjs';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
18
|
|
|
@@ -88,20 +88,24 @@ have Vitest auto retries on flaky segfaults.
|
|
|
88
88
|
}
|
|
89
89
|
async function start(preArgs, postArgs) {
|
|
90
90
|
var _a;
|
|
91
|
-
const child = execa(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
const child = execa(
|
|
92
|
+
"node",
|
|
93
|
+
[
|
|
94
|
+
...preArgs,
|
|
95
|
+
fileURLToPath(ENTRY),
|
|
96
|
+
...postArgs
|
|
97
|
+
],
|
|
98
|
+
{
|
|
99
|
+
reject: false,
|
|
100
|
+
stderr: "pipe",
|
|
101
|
+
stdout: "inherit",
|
|
102
|
+
stdin: "inherit",
|
|
103
|
+
env: {
|
|
104
|
+
...process.env,
|
|
105
|
+
VITEST_CLI_WRAPPER: "true"
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
|
-
|
|
108
|
+
);
|
|
105
109
|
(_a = child.stderr) == null ? void 0 : _a.pipe(process.stderr);
|
|
106
110
|
const { stderr = "" } = await child;
|
|
107
111
|
if (child.exitCode === EXIT_CODE_RESTART)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-constants.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-constants.6196597b.mjs';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.41bf722e.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'url';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-integrations-coverage.
|
|
7
|
+
import './chunk-integrations-coverage.99c020eb.mjs';
|
|
8
8
|
import 'local-pkg';
|
|
9
|
-
import './chunk-
|
|
9
|
+
import './chunk-env-node.ceb43f1c.mjs';
|
|
10
|
+
import 'console';
|
|
11
|
+
import './chunk-mock-date.0d86eaa5.mjs';
|
|
10
12
|
import 'vite';
|
|
11
13
|
import 'process';
|
|
12
14
|
import 'fs';
|
|
@@ -14,21 +16,22 @@ import 'os';
|
|
|
14
16
|
import 'util';
|
|
15
17
|
import 'stream';
|
|
16
18
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
17
|
-
import './chunk-vite-node-client.
|
|
19
|
+
import './chunk-vite-node-client.74ebe3d5.mjs';
|
|
18
20
|
import 'module';
|
|
19
21
|
import 'vm';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
22
|
+
import './chunk-vite-node-utils.68573626.mjs';
|
|
21
23
|
import 'assert';
|
|
22
24
|
import 'debug';
|
|
23
25
|
import 'perf_hooks';
|
|
24
26
|
import 'worker_threads';
|
|
25
27
|
import 'tinypool';
|
|
26
|
-
import './chunk-utils-source-map.
|
|
28
|
+
import './chunk-utils-source-map.70ee97e1.mjs';
|
|
27
29
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
28
30
|
import 'crypto';
|
|
29
|
-
import './vendor-index.
|
|
30
|
-
import './vendor-index.
|
|
31
|
-
import './chunk-magic-string.
|
|
31
|
+
import './vendor-index.13e3bda3.mjs';
|
|
32
|
+
import './vendor-index.731a22f2.mjs';
|
|
33
|
+
import './chunk-magic-string.56b2b543.mjs';
|
|
34
|
+
import 'strip-literal';
|
|
32
35
|
import 'readline';
|
|
33
36
|
import './vendor-index.ae96af6e.mjs';
|
|
34
37
|
|
|
@@ -651,20 +654,25 @@ cli.command("run [...filters]").action(run);
|
|
|
651
654
|
cli.command("related [...filters]").action(runRelated);
|
|
652
655
|
cli.command("watch [...filters]").action(start);
|
|
653
656
|
cli.command("dev [...filters]").action(start);
|
|
654
|
-
cli.command("[...filters]").action(
|
|
657
|
+
cli.command("bench [...filters]").action(benchmark);
|
|
658
|
+
cli.command("[...filters]").action((filter, options) => start("test", filter, options));
|
|
655
659
|
cli.parse();
|
|
656
660
|
async function runRelated(relatedFiles, argv) {
|
|
657
661
|
argv.related = relatedFiles;
|
|
658
662
|
argv.passWithNoTests ?? (argv.passWithNoTests = true);
|
|
659
|
-
await start([], argv);
|
|
663
|
+
await start("test", [], argv);
|
|
660
664
|
}
|
|
661
665
|
async function run(cliFilters, options) {
|
|
662
666
|
options.run = true;
|
|
663
|
-
await start(cliFilters, options);
|
|
667
|
+
await start("test", cliFilters, options);
|
|
664
668
|
}
|
|
665
|
-
async function
|
|
669
|
+
async function benchmark(cliFilters, options) {
|
|
670
|
+
console.warn(picocolors.exports.yellow("Benchmarking is an experimental feature. API might change in the future."));
|
|
671
|
+
await start("benchmark", cliFilters, options);
|
|
672
|
+
}
|
|
673
|
+
async function start(mode, cliFilters, options) {
|
|
666
674
|
try {
|
|
667
|
-
if (await startVitest(cliFilters, options) === false)
|
|
675
|
+
if (await startVitest(mode, cliFilters, options) === false)
|
|
668
676
|
process.exit();
|
|
669
677
|
} catch (e) {
|
|
670
678
|
process.exitCode = 1;
|
package/dist/config.cjs
CHANGED
|
@@ -26,7 +26,7 @@ const coverageConfigDefaults = {
|
|
|
26
26
|
reportsDirectory: "./coverage",
|
|
27
27
|
excludeNodeModules: true,
|
|
28
28
|
exclude: defaultCoverageExcludes,
|
|
29
|
-
reporter: ["text", "html", "clover"],
|
|
29
|
+
reporter: ["text", "html", "clover", "json"],
|
|
30
30
|
allowExternal: false,
|
|
31
31
|
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
32
32
|
};
|
|
@@ -72,7 +72,7 @@ const config = {
|
|
|
72
72
|
uiBase: "/__vitest__/",
|
|
73
73
|
open: true,
|
|
74
74
|
css: {
|
|
75
|
-
include: [
|
|
75
|
+
include: []
|
|
76
76
|
},
|
|
77
77
|
coverage: coverageConfigDefaults,
|
|
78
78
|
fakeTimers: fakeTimersDefaults,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv } from 'vite';
|
|
3
|
-
import { U as UserConfig$1,
|
|
4
|
-
import '
|
|
3
|
+
import { U as UserConfig$1, ad as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './global-ea084c9f.js';
|
|
4
|
+
import 'tinybench';
|
|
5
5
|
import 'fs';
|
|
6
|
+
import 'worker_threads';
|
|
6
7
|
|
|
7
8
|
declare const defaultInclude: string[];
|
|
8
9
|
declare const defaultExclude: string[];
|
|
@@ -31,7 +32,7 @@ declare const config: {
|
|
|
31
32
|
uiBase: string;
|
|
32
33
|
open: boolean;
|
|
33
34
|
css: {
|
|
34
|
-
include:
|
|
35
|
+
include: never[];
|
|
35
36
|
};
|
|
36
37
|
coverage: ResolvedCoverageOptions;
|
|
37
38
|
fakeTimers: FakeTimerInstallOpts;
|
package/dist/config.mjs
CHANGED
|
@@ -22,7 +22,7 @@ const coverageConfigDefaults = {
|
|
|
22
22
|
reportsDirectory: "./coverage",
|
|
23
23
|
excludeNodeModules: true,
|
|
24
24
|
exclude: defaultCoverageExcludes,
|
|
25
|
-
reporter: ["text", "html", "clover"],
|
|
25
|
+
reporter: ["text", "html", "clover", "json"],
|
|
26
26
|
allowExternal: false,
|
|
27
27
|
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
28
28
|
};
|
|
@@ -68,7 +68,7 @@ const config = {
|
|
|
68
68
|
uiBase: "/__vitest__/",
|
|
69
69
|
open: true,
|
|
70
70
|
css: {
|
|
71
|
-
include: [
|
|
71
|
+
include: []
|
|
72
72
|
},
|
|
73
73
|
coverage: coverageConfigDefaults,
|
|
74
74
|
fakeTimers: fakeTimersDefaults,
|
package/dist/entry.mjs
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { a as resetModules } from './chunk-mock-date.
|
|
3
|
-
import {
|
|
4
|
-
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.
|
|
5
|
-
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
2
|
+
import { g as getWorkerState, a as resetModules } from './chunk-mock-date.0d86eaa5.mjs';
|
|
3
|
+
import { a as envs } from './chunk-env-node.ceb43f1c.mjs';
|
|
4
|
+
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.ed9b4f70.mjs';
|
|
6
5
|
import 'path';
|
|
7
|
-
import './chunk-constants.
|
|
6
|
+
import './chunk-constants.6196597b.mjs';
|
|
8
7
|
import 'tty';
|
|
9
8
|
import 'url';
|
|
10
9
|
import 'local-pkg';
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
10
|
+
import 'console';
|
|
11
|
+
import 'perf_hooks';
|
|
12
|
+
import './chunk-integrations-coverage.99c020eb.mjs';
|
|
13
|
+
import './chunk-runtime-hooks.75ce0575.mjs';
|
|
14
|
+
import './chunk-runtime-chain.2af36ddf.mjs';
|
|
13
15
|
import 'util';
|
|
14
16
|
import 'chai';
|
|
15
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
16
|
-
import './chunk-runtime-rpc.
|
|
18
|
+
import './chunk-runtime-rpc.3fe371e9.mjs';
|
|
17
19
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
18
|
-
import './chunk-utils-source-map.
|
|
20
|
+
import './chunk-utils-source-map.70ee97e1.mjs';
|
|
19
21
|
import './spy.mjs';
|
|
20
22
|
import 'tinyspy';
|
|
21
23
|
|
|
@@ -31,8 +33,6 @@ async function run(files, config) {
|
|
|
31
33
|
var _a;
|
|
32
34
|
const code = await promises.readFile(file, "utf-8");
|
|
33
35
|
const env = ((_a = code.match(/@(?:vitest|jest)-environment\s+?([\w-]+)\b/)) == null ? void 0 : _a[1]) || config.environment || "node";
|
|
34
|
-
if (!envs.includes(env))
|
|
35
|
-
throw new Error(`Unsupported environment: "${env}" in ${file}`);
|
|
36
36
|
return {
|
|
37
37
|
file,
|
|
38
38
|
env
|
|
@@ -43,15 +43,20 @@ async function run(files, config) {
|
|
|
43
43
|
acc[env].push(file);
|
|
44
44
|
return acc;
|
|
45
45
|
}, {});
|
|
46
|
-
|
|
46
|
+
const orderedEnvs = envs.concat(
|
|
47
|
+
Object.keys(filesByEnv).filter((env) => !envs.includes(env))
|
|
48
|
+
);
|
|
49
|
+
for (const env of orderedEnvs) {
|
|
47
50
|
const environment = env;
|
|
48
51
|
const files2 = filesByEnv[environment];
|
|
49
52
|
if (!files2 || !files2.length)
|
|
50
53
|
continue;
|
|
51
54
|
await withEnv(environment, config.environmentOptions || {}, async () => {
|
|
52
55
|
for (const file of files2) {
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
if (config.isolate) {
|
|
57
|
+
workerState.mockMap.clear();
|
|
58
|
+
resetModules(workerState.moduleCache, true);
|
|
59
|
+
}
|
|
55
60
|
workerState.filepath = file;
|
|
56
61
|
await startTests([file], config);
|
|
57
62
|
workerState.filepath = void 0;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { a3 as Environment } from './global-ea084c9f.js';
|
|
2
|
+
import 'vite';
|
|
3
|
+
import 'tinybench';
|
|
4
|
+
import 'fs';
|
|
5
|
+
import 'worker_threads';
|
|
6
|
+
|
|
7
|
+
declare const environments: {
|
|
8
|
+
node: Environment;
|
|
9
|
+
jsdom: Environment;
|
|
10
|
+
'happy-dom': Environment;
|
|
11
|
+
'edge-runtime': Environment;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface PopulateOptions {
|
|
15
|
+
bindFunctions?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
|
|
18
|
+
keys: Set<string>;
|
|
19
|
+
skipKeys: string[];
|
|
20
|
+
originals: Map<string | symbol, any>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { environments as builtinEnvironments, populateGlobal };
|