vitest 0.0.102 → 0.0.103
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/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import require$$0 from 'readline';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { e as ensurePackageInstalled } from './utils-c8e62373.js';
|
|
4
|
-
import { c as createVitest } from './index-
|
|
4
|
+
import { c as createVitest } from './index-6f17b444.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
@@ -14,7 +14,7 @@ import 'stream';
|
|
|
14
14
|
import './constants-a1417084.js';
|
|
15
15
|
import 'url';
|
|
16
16
|
import 'perf_hooks';
|
|
17
|
-
import './error-
|
|
17
|
+
import './error-0e2f75a4.js';
|
|
18
18
|
import './index-825cb54c.js';
|
|
19
19
|
import './_commonjsHelpers-bdec4bbd.js';
|
|
20
20
|
import 'assert';
|
|
@@ -634,12 +634,10 @@ class CAC extends EventEmitter {
|
|
|
634
634
|
|
|
635
635
|
const cac = (name = "") => new CAC(name);
|
|
636
636
|
|
|
637
|
-
var version = "0.0.
|
|
637
|
+
var version = "0.0.103";
|
|
638
638
|
|
|
639
639
|
const cli = cac("vitest");
|
|
640
|
-
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("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
|
|
641
|
-
default: "node"
|
|
642
|
-
}).help();
|
|
640
|
+
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("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", { default: "node" }).option("--passWithNoTests", "pass when no tests found").help();
|
|
643
641
|
cli.command("run [...filters]").action(run);
|
|
644
642
|
cli.command("watch [...filters]").action(dev);
|
|
645
643
|
cli.command("dev [...filters]").action(dev);
|
|
@@ -679,8 +677,8 @@ function registerConsoleShortcuts(ctx) {
|
|
|
679
677
|
if (process.stdin.isTTY) {
|
|
680
678
|
require$$0.emitKeypressEvents(process.stdin);
|
|
681
679
|
process.stdin.setRawMode(true);
|
|
682
|
-
process.stdin.on("keypress", (str) => {
|
|
683
|
-
if (str === "" || str === "")
|
|
680
|
+
process.stdin.on("keypress", (str, key) => {
|
|
681
|
+
if (str === "" || str === "" || key && key.ctrl && key.name === "c")
|
|
684
682
|
process.exit();
|
|
685
683
|
if (ctx.runningPromise)
|
|
686
684
|
return;
|
package/dist/entry.js
CHANGED
|
@@ -6,7 +6,7 @@ import chai$1, { expect, util } from 'chai';
|
|
|
6
6
|
import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-bdec4bbd.js';
|
|
7
7
|
import { l as index, g as getNames, c as c$1, t as toArray, b as basename, m as interpretOnlyMode, p as partitionSuiteChildren, o as hasTests, j as hasFailed } from './utils-c8e62373.js';
|
|
8
8
|
import { r as rpc, s as send } from './rpc-7de86f29.js';
|
|
9
|
-
import { u as unifiedDiff } from './error-
|
|
9
|
+
import { u as unifiedDiff } from './error-0e2f75a4.js';
|
|
10
10
|
import { performance } from 'perf_hooks';
|
|
11
11
|
import { c as clearContext, b as defaultSuite, e as setHooks, f as getHooks, h as context, j as getFn } from './suite-64b3e636.js';
|
|
12
12
|
import { n as nanoid } from './index-9e71c815.js';
|
|
@@ -4615,6 +4615,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
4615
4615
|
const lines = source.split(splitRE);
|
|
4616
4616
|
let count = 0;
|
|
4617
4617
|
let res = [];
|
|
4618
|
+
const columns = process.stdout.columns || 80;
|
|
4618
4619
|
function lineNo(no = "") {
|
|
4619
4620
|
return c.gray(`${String(no).padStart(3, " ")}| `);
|
|
4620
4621
|
}
|
|
@@ -4627,7 +4628,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
4627
4628
|
const lineLength = lines[j].length;
|
|
4628
4629
|
if (lineLength > 200)
|
|
4629
4630
|
return "";
|
|
4630
|
-
res.push(lineNo(j + 1) + cliTruncate(lines[j],
|
|
4631
|
+
res.push(lineNo(j + 1) + cliTruncate(lines[j], columns - 5 - indent));
|
|
4631
4632
|
if (j === i) {
|
|
4632
4633
|
const pad = start - (count - lineLength);
|
|
4633
4634
|
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
|
@@ -4724,7 +4725,7 @@ ${indent}${c.red("+ actual")}
|
|
|
4724
4725
|
${cleanLines.map((l) => l()).join("\n")}`;
|
|
4725
4726
|
}
|
|
4726
4727
|
function formatLine(line) {
|
|
4727
|
-
return cliTruncate(line, (process.stdout.columns ||
|
|
4728
|
+
return cliTruncate(line, (process.stdout.columns || 80) - 1);
|
|
4728
4729
|
}
|
|
4729
4730
|
function renderTruncateMessage(indent) {
|
|
4730
4731
|
return `
|
|
@@ -9,7 +9,7 @@ import require$$0$2 from 'stream';
|
|
|
9
9
|
import require$$2 from 'events';
|
|
10
10
|
import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-a1417084.js';
|
|
11
11
|
import { performance } from 'perf_hooks';
|
|
12
|
-
import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-
|
|
12
|
+
import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-0e2f75a4.js';
|
|
13
13
|
import { o as onetime, s as signalExit } from './index-825cb54c.js';
|
|
14
14
|
import { MessageChannel } from 'worker_threads';
|
|
15
15
|
import { pathToFileURL } from 'url';
|
|
@@ -7837,8 +7837,11 @@ class Vitest {
|
|
|
7837
7837
|
async start(filters) {
|
|
7838
7838
|
const files = await this.globTestFiles(filters);
|
|
7839
7839
|
if (!files.length) {
|
|
7840
|
-
this.
|
|
7841
|
-
|
|
7840
|
+
if (this.config.passWithNoTests)
|
|
7841
|
+
this.log("No test files found\n");
|
|
7842
|
+
else
|
|
7843
|
+
this.error(c.red("No test files found\n"));
|
|
7844
|
+
process.exit(this.config.passWithNoTests ? 0 : 1);
|
|
7842
7845
|
}
|
|
7843
7846
|
await this.runFiles(files);
|
|
7844
7847
|
if (this.config.watch)
|
package/dist/index.d.ts
CHANGED
|
@@ -303,12 +303,12 @@ interface InlineConfig {
|
|
|
303
303
|
/**
|
|
304
304
|
* Include globs for test files
|
|
305
305
|
*
|
|
306
|
-
* @default ['**\/*.test.ts']
|
|
306
|
+
* @default ['**\/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
|
|
307
307
|
*/
|
|
308
308
|
include?: string[];
|
|
309
309
|
/**
|
|
310
310
|
* Exclude globs for test files
|
|
311
|
-
* @default ['
|
|
311
|
+
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
|
|
312
312
|
*/
|
|
313
313
|
exclude?: string[];
|
|
314
314
|
/**
|
|
@@ -446,6 +446,10 @@ interface UserConfig extends InlineConfig {
|
|
|
446
446
|
* Do not watch
|
|
447
447
|
*/
|
|
448
448
|
run?: boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Pass with no tests
|
|
451
|
+
*/
|
|
452
|
+
passWithNoTests?: boolean;
|
|
449
453
|
}
|
|
450
454
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
|
|
451
455
|
config?: string;
|
package/dist/node.d.ts
CHANGED
|
@@ -95,12 +95,12 @@ interface InlineConfig {
|
|
|
95
95
|
/**
|
|
96
96
|
* Include globs for test files
|
|
97
97
|
*
|
|
98
|
-
* @default ['**\/*.test.ts']
|
|
98
|
+
* @default ['**\/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
|
|
99
99
|
*/
|
|
100
100
|
include?: string[];
|
|
101
101
|
/**
|
|
102
102
|
* Exclude globs for test files
|
|
103
|
-
* @default ['
|
|
103
|
+
* @default ['node_modules', 'dist', '.idea', '.git', '.cache']
|
|
104
104
|
*/
|
|
105
105
|
exclude?: string[];
|
|
106
106
|
/**
|
|
@@ -238,6 +238,10 @@ interface UserConfig extends InlineConfig {
|
|
|
238
238
|
* Do not watch
|
|
239
239
|
*/
|
|
240
240
|
run?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Pass with no tests
|
|
243
|
+
*/
|
|
244
|
+
passWithNoTests?: boolean;
|
|
241
245
|
}
|
|
242
246
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
|
|
243
247
|
config?: string;
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as createVitest } from './index-
|
|
1
|
+
export { c as createVitest } from './index-6f17b444.js';
|
|
2
2
|
import './utils-c8e62373.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'local-pkg';
|
|
@@ -13,7 +13,7 @@ import 'events';
|
|
|
13
13
|
import './constants-a1417084.js';
|
|
14
14
|
import 'url';
|
|
15
15
|
import 'perf_hooks';
|
|
16
|
-
import './error-
|
|
16
|
+
import './error-0e2f75a4.js';
|
|
17
17
|
import './index-825cb54c.js';
|
|
18
18
|
import './_commonjsHelpers-bdec4bbd.js';
|
|
19
19
|
import 'assert';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
53
|
"local-pkg": "^0.4.0",
|
|
54
54
|
"tinypool": "^0.0.3",
|
|
55
|
-
"tinyspy": "^0.
|
|
55
|
+
"tinyspy": "^0.2.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@antfu/install-pkg": "^0.1.0",
|