vitest 1.2.2 → 1.3.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 -0
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -1
- package/dist/chunks/{api-setup.srzH0bDf.js → api-setup.Xh60JpeM.js} +27 -64
- package/dist/chunks/{integrations-globals.J_6tnlri.js → integrations-globals.FlQVNhQx.js} +6 -6
- package/dist/chunks/{runtime-runBaseTests.QReNMrJA.js → runtime-runBaseTests.0UwIvo_U.js} +9 -9
- package/dist/cli-wrapper.js +1 -1
- package/dist/cli.js +1314 -69
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +3 -3
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +74 -78
- package/dist/index.js +7 -7
- package/dist/node.d.ts +3 -3
- package/dist/node.js +21 -21
- package/dist/{reporters-1evA5lom.d.ts → reporters-QGe8gs4b.d.ts} +146 -55
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +20 -6
- package/dist/runners.d.ts +6 -6
- package/dist/runners.js +10 -10
- package/dist/{suite-ghspeorC.d.ts → suite-xGC-mxBC.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/vendor/{base.Rmxiv35Y.js → base.RpormaJz.js} +2 -2
- package/dist/vendor/{base.QYERqzkH.js → base.knFzp7G3.js} +1 -1
- package/dist/vendor/{benchmark.IlKmJkUU.js → benchmark.eeqk2rd8.js} +1 -1
- package/dist/vendor/{node.Zme77R4t.js → cli-api.RIYLcWhB.js} +1510 -3639
- package/dist/vendor/{constants.i1PoEnhr.js → constants.K-Wf1PUy.js} +3 -1
- package/dist/vendor/{execute.TxmaEFIQ.js → execute.aFSzc0Da.js} +23 -12
- package/dist/vendor/{index.cAUulNDf.js → index.8bPxjt7g.js} +6 -1
- package/dist/vendor/{index.RDKo8czB.js → index.CKbXK54q.js} +7 -3
- package/dist/vendor/{environments.sU0TD7wX.js → index.GVFv9dZ0.js} +3 -0
- package/dist/vendor/index.QcWmThJv.js +4927 -0
- package/dist/vendor/{index.rJjbcrrp.js → index.ir9i0ywP.js} +1 -1
- package/dist/vendor/{index.LgG0iblq.js → index.n-Ib4UWN.js} +4 -3
- package/dist/vendor/{rpc.w4v8oCkK.js → rpc.joBhAkyK.js} +10 -1
- package/dist/vendor/setup-common.NSpEdAQm.js +45 -0
- package/dist/vendor/{vi.PPwhENHF.js → vi.-Nr_x6dl.js} +2 -1
- package/dist/vendor/{vm.jVxKtN5R.js → vm.UmCkcXp-.js} +25 -8
- package/dist/worker.js +5 -10
- package/dist/workers/forks.js +3 -3
- package/dist/workers/runVmTests.js +13 -9
- package/dist/workers/threads.js +3 -3
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +8 -8
- package/globals.d.ts +2 -0
- package/jsdom.d.ts +6 -0
- package/package.json +24 -21
- package/dist/vendor/reporters.cA9x-5v-.js +0 -2664
- package/dist/vendor/setup-common.C2iBd0K0.js +0 -29
package/LICENSE.md
CHANGED
|
@@ -306,6 +306,35 @@ Repository: micromatch/braces
|
|
|
306
306
|
|
|
307
307
|
---------------------------------------
|
|
308
308
|
|
|
309
|
+
## cac
|
|
310
|
+
License: MIT
|
|
311
|
+
By: egoist
|
|
312
|
+
Repository: egoist/cac
|
|
313
|
+
|
|
314
|
+
> The MIT License (MIT)
|
|
315
|
+
>
|
|
316
|
+
> Copyright (c) EGOIST <0x142857@gmail.com> (https://github.com/egoist)
|
|
317
|
+
>
|
|
318
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
319
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
320
|
+
> in the Software without restriction, including without limitation the rights
|
|
321
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
322
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
323
|
+
> furnished to do so, subject to the following conditions:
|
|
324
|
+
>
|
|
325
|
+
> The above copyright notice and this permission notice shall be included in
|
|
326
|
+
> all copies or substantial portions of the Software.
|
|
327
|
+
>
|
|
328
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
329
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
330
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
331
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
332
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
333
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
334
|
+
> THE SOFTWARE.
|
|
335
|
+
|
|
336
|
+
---------------------------------------
|
|
337
|
+
|
|
309
338
|
## chai-subset
|
|
310
339
|
License: MIT
|
|
311
340
|
By: Andrii Shumada, Robert Herhold
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { processError, startTests } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig, C as CoverageOptions, b as CoverageProvider, c as CoverageProviderModule } from './reporters-QGe8gs4b.js';
|
|
3
3
|
import { VitestExecutor } from './execute.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -41,6 +41,7 @@ interface DiffOptions {
|
|
|
41
41
|
|
|
42
42
|
declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
|
|
43
43
|
declare function loadDiffConfig(config: ResolvedConfig, executor: VitestExecutor): Promise<DiffOptions | undefined>;
|
|
44
|
+
declare function loadSnapshotSerializers(config: ResolvedConfig, executor: VitestExecutor): Promise<void>;
|
|
44
45
|
|
|
45
46
|
interface Loader {
|
|
46
47
|
executeId: (id: string) => Promise<{
|
|
@@ -52,4 +53,4 @@ declare function startCoverageInsideWorker(options: CoverageOptions | undefined,
|
|
|
52
53
|
declare function takeCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
|
|
53
54
|
declare function stopCoverageInsideWorker(options: CoverageOptions | undefined, loader: Loader): Promise<unknown>;
|
|
54
55
|
|
|
55
|
-
export { getCoverageProvider, loadDiffConfig, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
|
56
|
+
export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { processError, startTests } from '@vitest/runner';
|
|
2
|
-
export { l as loadDiffConfig, s as setupCommonEnv } from './vendor/setup-common.
|
|
2
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.NSpEdAQm.js';
|
|
3
3
|
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
+
import '@vitest/snapshot';
|
|
5
6
|
import './vendor/run-once.Olz_Zkd8.js';
|
|
6
7
|
import './vendor/global.CkGT_TMy.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, promises } from 'node:fs';
|
|
2
2
|
import { dirname } from 'pathe';
|
|
3
|
-
import { c as createBirpc } from '../vendor/index.
|
|
3
|
+
import { c as createBirpc } from '../vendor/index.8bPxjt7g.js';
|
|
4
4
|
import require$$0$2 from 'stream';
|
|
5
5
|
import require$$0 from 'zlib';
|
|
6
6
|
import require$$0$1 from 'buffer';
|
|
@@ -13,56 +13,14 @@ import require$$4 from 'tls';
|
|
|
13
13
|
import require$$7 from 'url';
|
|
14
14
|
import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
15
|
import { isFileServingAllowed } from 'vite';
|
|
16
|
-
import { A as API_PATH } from '../vendor/constants.
|
|
17
|
-
import '../vendor/index.
|
|
18
|
-
import { W as WorkspaceProject } from '../vendor/node.Zme77R4t.js';
|
|
16
|
+
import { A as API_PATH } from '../vendor/constants.K-Wf1PUy.js';
|
|
17
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
19
18
|
import '@vitest/utils';
|
|
20
19
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
21
|
-
import { a as isPrimitive } from '../vendor/base.
|
|
20
|
+
import { a as isPrimitive } from '../vendor/base.knFzp7G3.js';
|
|
22
21
|
import 'std-env';
|
|
23
22
|
import '@vitest/runner/utils';
|
|
24
23
|
import '../vendor/global.CkGT_TMy.js';
|
|
25
|
-
import 'node:path';
|
|
26
|
-
import 'node:url';
|
|
27
|
-
import 'node:process';
|
|
28
|
-
import 'os';
|
|
29
|
-
import 'path';
|
|
30
|
-
import '../vendor/index.xL8XjTLv.js';
|
|
31
|
-
import 'util';
|
|
32
|
-
import 'fs';
|
|
33
|
-
import 'picocolors';
|
|
34
|
-
import 'vite-node/client';
|
|
35
|
-
import '@vitest/snapshot/manager';
|
|
36
|
-
import 'vite-node/server';
|
|
37
|
-
import '../vendor/coverage.E7sG1b3r.js';
|
|
38
|
-
import '../path.js';
|
|
39
|
-
import 'node:v8';
|
|
40
|
-
import 'node:os';
|
|
41
|
-
import 'node:events';
|
|
42
|
-
import 'tinypool';
|
|
43
|
-
import 'node:worker_threads';
|
|
44
|
-
import 'node:fs/promises';
|
|
45
|
-
import 'node:perf_hooks';
|
|
46
|
-
import 'execa';
|
|
47
|
-
import 'module';
|
|
48
|
-
import 'acorn-walk';
|
|
49
|
-
import '../vendor/reporters.cA9x-5v-.js';
|
|
50
|
-
import './runtime-console.Iloo9fIt.js';
|
|
51
|
-
import 'node:stream';
|
|
52
|
-
import 'node:console';
|
|
53
|
-
import '../vendor/date.Ns1pGd_X.js';
|
|
54
|
-
import '../vendor/tasks.IknbGB2n.js';
|
|
55
|
-
import 'node:module';
|
|
56
|
-
import 'local-pkg';
|
|
57
|
-
import 'node:crypto';
|
|
58
|
-
import 'vite-node/utils';
|
|
59
|
-
import 'assert';
|
|
60
|
-
import 'magic-string';
|
|
61
|
-
import '@vitest/utils/ast';
|
|
62
|
-
import 'strip-literal';
|
|
63
|
-
import '../vendor/environments.sU0TD7wX.js';
|
|
64
|
-
import 'node:readline';
|
|
65
|
-
import 'readline';
|
|
66
24
|
|
|
67
25
|
async function getModuleGraph(ctx, id) {
|
|
68
26
|
const graph = {};
|
|
@@ -4634,10 +4592,6 @@ function setup(vitestOrWorkspace, _server) {
|
|
|
4634
4592
|
async onUnhandledError(error, type) {
|
|
4635
4593
|
ctx.state.catchError(error, type);
|
|
4636
4594
|
},
|
|
4637
|
-
async onDone(testId) {
|
|
4638
|
-
var _a2;
|
|
4639
|
-
return (_a2 = ctx.state.browserTestPromises.get(testId)) == null ? void 0 : _a2.resolve(true);
|
|
4640
|
-
},
|
|
4641
4595
|
async onCollected(files) {
|
|
4642
4596
|
ctx.state.collectFiles(files);
|
|
4643
4597
|
await ctx.report("onCollected", files);
|
|
@@ -4699,8 +4653,6 @@ function setup(vitestOrWorkspace, _server) {
|
|
|
4699
4653
|
await ctx.rerunFiles(files);
|
|
4700
4654
|
},
|
|
4701
4655
|
getConfig() {
|
|
4702
|
-
if (vitestOrWorkspace instanceof WorkspaceProject)
|
|
4703
|
-
return wrapConfig(vitestOrWorkspace.getSerializableConfig());
|
|
4704
4656
|
return vitestOrWorkspace.config;
|
|
4705
4657
|
},
|
|
4706
4658
|
async getTransformResult(id) {
|
|
@@ -4724,15 +4676,30 @@ function setup(vitestOrWorkspace, _server) {
|
|
|
4724
4676
|
onCancel(reason) {
|
|
4725
4677
|
ctx.cancelCurrentRun(reason);
|
|
4726
4678
|
},
|
|
4679
|
+
debug(...args) {
|
|
4680
|
+
ctx.logger.console.debug(...args);
|
|
4681
|
+
},
|
|
4727
4682
|
getCountOfFailedTests() {
|
|
4728
4683
|
return ctx.state.getCountOfFailedTests();
|
|
4729
4684
|
},
|
|
4730
|
-
// browser should have a separate RPC in the future, UI doesn't care for provided context
|
|
4731
|
-
getProvidedContext() {
|
|
4732
|
-
return "ctx" in vitestOrWorkspace ? vitestOrWorkspace.getProvidedContext() : {};
|
|
4733
|
-
},
|
|
4734
4685
|
getUnhandledErrors() {
|
|
4735
4686
|
return ctx.state.getUnhandledErrors();
|
|
4687
|
+
},
|
|
4688
|
+
// TODO: have a separate websocket conection for private browser API
|
|
4689
|
+
getBrowserFiles() {
|
|
4690
|
+
var _a2;
|
|
4691
|
+
if (!("ctx" in vitestOrWorkspace))
|
|
4692
|
+
throw new Error("`getBrowserTestFiles` is only available in the browser API");
|
|
4693
|
+
return ((_a2 = vitestOrWorkspace.browserState) == null ? void 0 : _a2.files) ?? [];
|
|
4694
|
+
},
|
|
4695
|
+
finishBrowserTests() {
|
|
4696
|
+
var _a2;
|
|
4697
|
+
if (!("ctx" in vitestOrWorkspace))
|
|
4698
|
+
throw new Error("`finishBrowserTests` is only available in the browser API");
|
|
4699
|
+
return (_a2 = vitestOrWorkspace.browserState) == null ? void 0 : _a2.resolve();
|
|
4700
|
+
},
|
|
4701
|
+
getProvidedContext() {
|
|
4702
|
+
return "ctx" in vitestOrWorkspace ? vitestOrWorkspace.getProvidedContext() : {};
|
|
4736
4703
|
}
|
|
4737
4704
|
},
|
|
4738
4705
|
{
|
|
@@ -4740,7 +4707,10 @@ function setup(vitestOrWorkspace, _server) {
|
|
|
4740
4707
|
on: (fn) => ws.on("message", fn),
|
|
4741
4708
|
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
|
|
4742
4709
|
serialize: (data) => stringify(data, stringifyReplace),
|
|
4743
|
-
deserialize: parse$3
|
|
4710
|
+
deserialize: parse$3,
|
|
4711
|
+
onTimeoutError(functionName) {
|
|
4712
|
+
throw new Error(`[vitest-api]: Timeout calling "${functionName}"`);
|
|
4713
|
+
}
|
|
4744
4714
|
}
|
|
4745
4715
|
);
|
|
4746
4716
|
ctx.onCancel((reason) => rpc.onCancel(reason));
|
|
@@ -4797,12 +4767,5 @@ class WebSocketReporter {
|
|
|
4797
4767
|
});
|
|
4798
4768
|
}
|
|
4799
4769
|
}
|
|
4800
|
-
function wrapConfig(config) {
|
|
4801
|
-
return {
|
|
4802
|
-
...config,
|
|
4803
|
-
// workaround RegExp serialization
|
|
4804
|
-
testNamePattern: config.testNamePattern ? config.testNamePattern.toString() : void 0
|
|
4805
|
-
};
|
|
4806
|
-
}
|
|
4807
4770
|
|
|
4808
4771
|
export { setup };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { g as globalApis } from '../vendor/constants.
|
|
2
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
1
|
+
import { g as globalApis } from '../vendor/constants.K-Wf1PUy.js';
|
|
2
|
+
import { V as VitestIndex } from '../vendor/index.n-Ib4UWN.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import '../vendor/benchmark.
|
|
4
|
+
import '../vendor/benchmark.eeqk2rd8.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import '../vendor/index.
|
|
7
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
8
8
|
import 'pathe';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import '../vendor/global.CkGT_TMy.js';
|
|
11
11
|
import '../vendor/run-once.Olz_Zkd8.js';
|
|
12
|
-
import '../vendor/vi.
|
|
12
|
+
import '../vendor/vi.-Nr_x6dl.js';
|
|
13
13
|
import 'chai';
|
|
14
14
|
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
15
|
import '@vitest/expect';
|
|
@@ -17,7 +17,7 @@ import '@vitest/snapshot';
|
|
|
17
17
|
import '@vitest/utils/error';
|
|
18
18
|
import '../vendor/tasks.IknbGB2n.js';
|
|
19
19
|
import '@vitest/utils/source-map';
|
|
20
|
-
import '../vendor/base.
|
|
20
|
+
import '../vendor/base.knFzp7G3.js';
|
|
21
21
|
import '../vendor/date.Ns1pGd_X.js';
|
|
22
22
|
import '@vitest/spy';
|
|
23
23
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests } from '@vitest/runner';
|
|
3
|
-
import '../vendor/index.
|
|
4
|
-
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.
|
|
3
|
+
import '../vendor/index.ir9i0ywP.js';
|
|
4
|
+
import { a as globalExpect, r as resetModules, v as vi } from '../vendor/vi.-Nr_x6dl.js';
|
|
5
5
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
|
|
6
|
-
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.
|
|
6
|
+
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from '../vendor/index.CKbXK54q.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import util from 'node:util';
|
|
9
9
|
import timers from 'node:timers';
|
|
10
10
|
import { isatty } from 'node:tty';
|
|
11
11
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
12
12
|
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
13
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
14
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
13
|
+
import { V as VitestIndex } from '../vendor/index.n-Ib4UWN.js';
|
|
14
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.NSpEdAQm.js';
|
|
15
15
|
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
|
|
16
16
|
import 'pathe';
|
|
17
17
|
import 'std-env';
|
|
@@ -23,15 +23,15 @@ import '@vitest/snapshot';
|
|
|
23
23
|
import '@vitest/utils/error';
|
|
24
24
|
import '../vendor/tasks.IknbGB2n.js';
|
|
25
25
|
import '@vitest/utils/source-map';
|
|
26
|
-
import '../vendor/base.
|
|
26
|
+
import '../vendor/base.knFzp7G3.js';
|
|
27
27
|
import '../vendor/date.Ns1pGd_X.js';
|
|
28
28
|
import '@vitest/spy';
|
|
29
29
|
import '@vitest/snapshot/environment';
|
|
30
30
|
import '../path.js';
|
|
31
31
|
import 'node:url';
|
|
32
|
-
import '../vendor/rpc.
|
|
33
|
-
import '../vendor/index.
|
|
34
|
-
import '../vendor/benchmark.
|
|
32
|
+
import '../vendor/rpc.joBhAkyK.js';
|
|
33
|
+
import '../vendor/index.8bPxjt7g.js';
|
|
34
|
+
import '../vendor/benchmark.eeqk2rd8.js';
|
|
35
35
|
import '../vendor/run-once.Olz_Zkd8.js';
|
|
36
36
|
|
|
37
37
|
let globalSetup = false;
|
package/dist/cli-wrapper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import c from 'picocolors';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
|
-
import { E as EXIT_CODE_RESTART } from './vendor/constants.
|
|
4
|
+
import { E as EXIT_CODE_RESTART } from './vendor/constants.K-Wf1PUy.js';
|
|
5
5
|
|
|
6
6
|
const ENTRY = new URL("./cli.js", import.meta.url);
|
|
7
7
|
const NODE_ARGS = [
|