vitest 0.0.85 → 0.0.90
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/bin/vitest.mjs +2 -0
- package/dist/cli.js +25 -9
- package/dist/entry.js +286 -209
- package/dist/{error-c651f5ae.js → error-309196c9.js} +5 -68
- package/dist/{global-e172af93.js → global-f3eab75a.js} +2 -2
- package/dist/index-722fb5a5.js +122 -0
- package/dist/{index-c033f95e.js → index-733e7378.js} +157 -156
- package/dist/index.d.ts +49 -2
- package/dist/index.js +2 -2
- package/dist/node.js +5 -5
- package/dist/{suite-0e21bf9b.js → suite-b8c6cb53.js} +2 -2
- package/dist/utils-385e2d09.js +143 -0
- package/dist/utils.js +3 -0
- package/dist/worker.js +8259 -35
- package/package.json +10 -5
- package/dist/index-906ac3f9.js +0 -34
- package/dist/utils-9dcc4050.js +0 -64
package/bin/vitest.mjs
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
4
|
import { resolve } from 'path'
|
|
5
|
+
import { checkPeerDependency } from '../dist/utils.js'
|
|
5
6
|
|
|
6
7
|
const argv = process.argv.slice(2)
|
|
7
8
|
|
|
8
9
|
if (argv.includes('--coverage')) {
|
|
10
|
+
checkPeerDependency('c8/bin/c8.js')
|
|
9
11
|
const filename = fileURLToPath(import.meta.url)
|
|
10
12
|
const entry = resolve(filename, '../../dist/cli.js')
|
|
11
13
|
process.argv.splice(2, 0, process.argv[0], entry)
|
package/dist/cli.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import readline from 'readline';
|
|
1
2
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { c } from './
|
|
3
|
-
import { c as createVitest } from './index-
|
|
4
|
-
import '
|
|
5
|
-
import 'path';
|
|
3
|
+
import { c } from './utils-385e2d09.js';
|
|
4
|
+
import { c as createVitest } from './index-733e7378.js';
|
|
5
|
+
import 'module';
|
|
6
6
|
import 'tty';
|
|
7
|
-
import '
|
|
8
|
-
import './utils-9dcc4050.js';
|
|
7
|
+
import 'path';
|
|
9
8
|
import 'vite';
|
|
10
9
|
import 'process';
|
|
10
|
+
import 'fs';
|
|
11
11
|
import './constants-adef7ffb.js';
|
|
12
12
|
import 'url';
|
|
13
13
|
import 'perf_hooks';
|
|
14
|
+
import './error-309196c9.js';
|
|
15
|
+
import 'source-map';
|
|
14
16
|
import 'assert';
|
|
15
17
|
import 'worker_threads';
|
|
16
18
|
import 'piscina';
|
|
17
19
|
import 'fast-glob';
|
|
18
20
|
import 'micromatch';
|
|
19
|
-
import 'readline';
|
|
20
21
|
|
|
21
22
|
function toArr(any) {
|
|
22
23
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -631,7 +632,7 @@ class CAC extends EventEmitter {
|
|
|
631
632
|
|
|
632
633
|
const cac = (name = "") => new CAC(name);
|
|
633
634
|
|
|
634
|
-
var version = "0.0.
|
|
635
|
+
var version = "0.0.90";
|
|
635
636
|
|
|
636
637
|
const cli = cac("vitest");
|
|
637
638
|
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
|
|
@@ -657,8 +658,9 @@ async function run(cliFilters, options) {
|
|
|
657
658
|
const ctx = await createVitest(options);
|
|
658
659
|
process.__vitest__ = ctx;
|
|
659
660
|
process.chdir(ctx.config.root);
|
|
661
|
+
registerConsoleShortcuts(ctx);
|
|
660
662
|
try {
|
|
661
|
-
await ctx.
|
|
663
|
+
await ctx.start(cliFilters);
|
|
662
664
|
} catch (e) {
|
|
663
665
|
process.exitCode = 1;
|
|
664
666
|
throw e;
|
|
@@ -667,3 +669,17 @@ async function run(cliFilters, options) {
|
|
|
667
669
|
await ctx.close();
|
|
668
670
|
}
|
|
669
671
|
}
|
|
672
|
+
function registerConsoleShortcuts(ctx) {
|
|
673
|
+
if (process.stdin.isTTY) {
|
|
674
|
+
readline.emitKeypressEvents(process.stdin);
|
|
675
|
+
process.stdin.setRawMode(true);
|
|
676
|
+
process.stdin.on("keypress", (str) => {
|
|
677
|
+
if (str === "" || str === "")
|
|
678
|
+
process.exit();
|
|
679
|
+
if (ctx.runningPromise)
|
|
680
|
+
return;
|
|
681
|
+
if (ctx.isFirstRun)
|
|
682
|
+
process.exit();
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|