vitest 0.0.89 → 0.0.93
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 +6 -2
- package/dist/cli.js +19 -12
- package/dist/{constants-adef7ffb.js → constants-9cfa4d7b.js} +1 -2
- package/dist/entry.js +418 -221
- package/dist/{error-309196c9.js → error-bf2213e4.js} +1 -1
- package/dist/{global-f3eab75a.js → global-c40aeb86.js} +2 -2
- package/dist/index-5cc247ff.js +331 -0
- package/dist/index-708135df.js +333 -0
- package/dist/index-880654a3.js +5539 -0
- package/dist/index-e7a421bb.js +2409 -0
- package/dist/index-fa899e66.js +5707 -0
- package/dist/index.d.ts +73 -7
- package/dist/index.js +1 -1
- package/dist/middleware-bf0f818d.js +78 -0
- package/dist/node.js +8 -7
- package/dist/{utils-385e2d09.js → utils-576876dc.js} +35 -16
- package/dist/utils.js +2 -2
- package/dist/worker.js +8 -16
- package/global.d.ts +1 -2
- package/package.json +11 -6
- package/dist/index-722fb5a5.js +0 -122
- package/dist/index-733e7378.js +0 -1896
- package/dist/middleware-650c5fa0.js +0 -34
package/bin/vitest.mjs
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
4
|
import { resolve } from 'path'
|
|
5
|
-
import {
|
|
5
|
+
import { ensurePackageInstalled } from '../dist/utils.js'
|
|
6
6
|
|
|
7
7
|
const argv = process.argv.slice(2)
|
|
8
8
|
|
|
9
|
+
if (!await ensurePackageInstalled('vite'))
|
|
10
|
+
process.exit(1)
|
|
11
|
+
|
|
9
12
|
if (argv.includes('--coverage')) {
|
|
10
|
-
|
|
13
|
+
if (!await ensurePackageInstalled('c8'))
|
|
14
|
+
process.exit(1)
|
|
11
15
|
const filename = fileURLToPath(import.meta.url)
|
|
12
16
|
const entry = resolve(filename, '../../dist/cli.js')
|
|
13
17
|
process.argv.splice(2, 0, process.argv[0], entry)
|
package/dist/cli.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import require$$0 from 'readline';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { c } from './utils-
|
|
4
|
-
import { c as createVitest } from './index-
|
|
5
|
-
import 'module';
|
|
3
|
+
import { c, e as ensurePackageInstalled } from './utils-576876dc.js';
|
|
4
|
+
import { c as createVitest } from './index-880654a3.js';
|
|
6
5
|
import 'tty';
|
|
6
|
+
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'vite';
|
|
9
9
|
import 'process';
|
|
10
10
|
import 'fs';
|
|
11
|
-
import '
|
|
11
|
+
import 'fast-glob';
|
|
12
|
+
import 'util';
|
|
13
|
+
import './constants-9cfa4d7b.js';
|
|
12
14
|
import 'url';
|
|
13
15
|
import 'perf_hooks';
|
|
14
|
-
import './error-
|
|
16
|
+
import './error-bf2213e4.js';
|
|
15
17
|
import 'source-map';
|
|
18
|
+
import './index-5cc247ff.js';
|
|
16
19
|
import 'assert';
|
|
17
20
|
import 'worker_threads';
|
|
18
21
|
import 'piscina';
|
|
19
|
-
import 'fast-glob';
|
|
20
|
-
import 'micromatch';
|
|
21
22
|
|
|
22
23
|
function toArr(any) {
|
|
23
24
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -632,7 +633,7 @@ class CAC extends EventEmitter {
|
|
|
632
633
|
|
|
633
634
|
const cac = (name = "") => new CAC(name);
|
|
634
635
|
|
|
635
|
-
var version = "0.0.
|
|
636
|
+
var version = "0.0.93";
|
|
636
637
|
|
|
637
638
|
const cli = cac("vitest");
|
|
638
639
|
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", {
|
|
@@ -653,12 +654,18 @@ async function run(cliFilters, options) {
|
|
|
653
654
|
process.env.NODE_ENV = "test";
|
|
654
655
|
if (!options.silent) {
|
|
655
656
|
console.log(c.magenta(c.bold("\nVitest is in closed beta exclusively for Sponsors")));
|
|
656
|
-
console.log(c.yellow("Learn more at https://vitest.dev
|
|
657
|
+
console.log(c.yellow("Learn more at https://vitest.dev"));
|
|
657
658
|
}
|
|
658
659
|
const ctx = await createVitest(options);
|
|
659
|
-
process.__vitest__ = ctx;
|
|
660
660
|
process.chdir(ctx.config.root);
|
|
661
661
|
registerConsoleShortcuts(ctx);
|
|
662
|
+
if (ctx.config.environment && ctx.config.environment !== "node") {
|
|
663
|
+
if (!await ensurePackageInstalled(ctx.config.environment))
|
|
664
|
+
process.exit(1);
|
|
665
|
+
}
|
|
666
|
+
ctx.onServerRestarted(() => {
|
|
667
|
+
ctx.start(cliFilters);
|
|
668
|
+
});
|
|
662
669
|
try {
|
|
663
670
|
await ctx.start(cliFilters);
|
|
664
671
|
} catch (e) {
|
|
@@ -671,7 +678,7 @@ async function run(cliFilters, options) {
|
|
|
671
678
|
}
|
|
672
679
|
function registerConsoleShortcuts(ctx) {
|
|
673
680
|
if (process.stdin.isTTY) {
|
|
674
|
-
|
|
681
|
+
require$$0.emitKeypressEvents(process.stdin);
|
|
675
682
|
process.stdin.setRawMode(true);
|
|
676
683
|
process.stdin.on("keypress", (str) => {
|
|
677
684
|
if (str === "" || str === "")
|