vitest 0.8.5 → 0.9.2
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/{chunk-api-setup.da2f55ae.js → chunk-api-setup.7290422e.js} +4 -4
- package/dist/{chunk-constants.76cf224a.js → chunk-constants.e59013dc.js} +1 -1
- package/dist/{chunk-defaults.e85b72aa.js → chunk-defaults.9aa0ce42.js} +1 -1
- package/dist/{chunk-integrations-globals.3713535d.js → chunk-integrations-globals.c040aaa9.js} +5 -6
- package/dist/{chunk-runtime-chain.c86f1eb0.js → chunk-runtime-chain.94cf66a4.js} +195 -2615
- package/dist/{chunk-runtime-mocker.7cc59bee.js → chunk-runtime-mocker.7f4b1850.js} +6 -5
- package/dist/chunk-runtime-rpc.4b80b6bd.js +7 -0
- package/dist/{chunk-utils-base.aff0a195.js → chunk-utils-global.10dcdfa6.js} +18 -1
- package/dist/{chunk-utils-timers.5657f2a4.js → chunk-utils-timers.4800834c.js} +2433 -10
- package/dist/{chunk-vite-node-externalize.e472da7d.js → chunk-vite-node-externalize.ddf2a6fb.js} +56 -19
- package/dist/{chunk-vite-node-utils.a6890356.js → chunk-vite-node-utils.7f0053fb.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/entry.js +8 -8
- package/dist/index.d.ts +10 -6
- package/dist/index.js +4 -5
- package/dist/node.d.ts +4 -1
- package/dist/node.js +7 -8
- package/dist/worker.js +5 -6
- package/package.json +4 -4
- package/dist/chunk-runtime-rpc.5263102e.js +0 -8
- package/dist/chunk-utils-global.7bcfa03c.js +0 -5
package/dist/{chunk-vite-node-externalize.e472da7d.js → chunk-vite-node-externalize.ddf2a6fb.js}
RENAMED
|
@@ -5,17 +5,17 @@ import process$2 from 'process';
|
|
|
5
5
|
import { o as onExit, m as mergeStream, g as getStream, c as crossSpawn, a as onetime$1 } from './vendor-index.87b2fc14.js';
|
|
6
6
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import require$$0, { constants as constants$8, hostname, cpus } from 'os';
|
|
8
|
-
import { j as join,
|
|
8
|
+
import { j as join, h as basename, k as dirname, e as c, s as slash$2, l as isAbsolute, m as relative, o as getTests, p as getFullName, q as hasFailed, u as hasFailedSnapshot, v as getSuites, w as resolve, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, b as getCallLastIndex, f as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.10dcdfa6.js';
|
|
9
9
|
import { createServer, mergeConfig } from 'vite';
|
|
10
10
|
import fs$8, { promises, existsSync } from 'fs';
|
|
11
|
-
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.
|
|
11
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.e59013dc.js';
|
|
12
12
|
import require$$0$1 from 'util';
|
|
13
13
|
import require$$0$2 from 'stream';
|
|
14
14
|
import require$$2 from 'events';
|
|
15
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
16
|
-
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.
|
|
15
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.7f0053fb.js';
|
|
16
|
+
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.9aa0ce42.js';
|
|
17
17
|
import { performance } from 'perf_hooks';
|
|
18
|
-
import {
|
|
18
|
+
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, s as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, d as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, c as clearTimeout$1 } from './chunk-utils-timers.4800834c.js';
|
|
19
19
|
import { a as commonjsGlobal } from './vendor-_commonjsHelpers.34b404ce.js';
|
|
20
20
|
import assert$1 from 'assert';
|
|
21
21
|
import { MessageChannel } from 'worker_threads';
|
|
@@ -24,7 +24,7 @@ import MagicString from './chunk-magic-string.d5e0e473.js';
|
|
|
24
24
|
import require$$0$3 from 'readline';
|
|
25
25
|
import { p as prompts } from './vendor-index.ee829ed6.js';
|
|
26
26
|
|
|
27
|
-
var version = "0.
|
|
27
|
+
var version = "0.9.2";
|
|
28
28
|
|
|
29
29
|
function stripFinalNewline(input) {
|
|
30
30
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -10351,9 +10351,7 @@ const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
|
|
|
10351
10351
|
const ESM_FOLDER_RE = /\/esm\/(.*\.js)$/;
|
|
10352
10352
|
const defaultInline = [
|
|
10353
10353
|
/virtual:/,
|
|
10354
|
-
/\.ts
|
|
10355
|
-
ESM_EXT_RE,
|
|
10356
|
-
ESM_FOLDER_RE
|
|
10354
|
+
/\.ts$/
|
|
10357
10355
|
];
|
|
10358
10356
|
const depsExternal = [
|
|
10359
10357
|
/\.cjs\.js$/,
|
|
@@ -10784,10 +10782,26 @@ class BaseReporter {
|
|
|
10784
10782
|
return;
|
|
10785
10783
|
for (const pack of packs) {
|
|
10786
10784
|
const task = this.ctx.state.idMap.get(pack[0]);
|
|
10787
|
-
if (task &&
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10785
|
+
if (task && "filepath" in task && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
|
|
10786
|
+
const tests = getTests(task);
|
|
10787
|
+
const failed = tests.filter((t) => {
|
|
10788
|
+
var _a2;
|
|
10789
|
+
return ((_a2 = t.result) == null ? void 0 : _a2.state) === "fail";
|
|
10790
|
+
});
|
|
10791
|
+
const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
|
|
10792
|
+
let state = c.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
|
|
10793
|
+
if (failed.length)
|
|
10794
|
+
state += ` ${c.dim("|")} ${c.red(`${failed.length} failed`)}`;
|
|
10795
|
+
if (skipped.length)
|
|
10796
|
+
state += ` ${c.dim("|")} ${c.yellow(`${skipped.length} skipped`)}`;
|
|
10797
|
+
let suffix = c.dim(" (") + state + c.dim(")");
|
|
10798
|
+
if (task.result.duration)
|
|
10799
|
+
suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
|
|
10800
|
+
this.ctx.log(` ${getStateSymbol(task)} ${task.name} ${suffix}`);
|
|
10801
|
+
for (const test of failed) {
|
|
10802
|
+
this.ctx.log(c.red(` ${pointer} ${getFullName(test)}`));
|
|
10803
|
+
this.ctx.log(c.red(` ${F_RIGHT} ${(_c = test.result.error) == null ? void 0 : _c.message}`));
|
|
10804
|
+
}
|
|
10791
10805
|
}
|
|
10792
10806
|
}
|
|
10793
10807
|
}
|
|
@@ -11897,6 +11911,14 @@ class DotReporter extends BaseReporter {
|
|
|
11897
11911
|
}
|
|
11898
11912
|
}
|
|
11899
11913
|
|
|
11914
|
+
const getOutputFile = ({ config }, reporter) => {
|
|
11915
|
+
if (!config.outputFile)
|
|
11916
|
+
return;
|
|
11917
|
+
if (typeof config.outputFile === "string")
|
|
11918
|
+
return config.outputFile;
|
|
11919
|
+
return config.outputFile[reporter];
|
|
11920
|
+
};
|
|
11921
|
+
|
|
11900
11922
|
const StatusMap = {
|
|
11901
11923
|
fail: "failed",
|
|
11902
11924
|
only: "pending",
|
|
@@ -12008,8 +12030,9 @@ class JsonReporter {
|
|
|
12008
12030
|
await this.logTasks(files);
|
|
12009
12031
|
}
|
|
12010
12032
|
async writeReport(report) {
|
|
12011
|
-
|
|
12012
|
-
|
|
12033
|
+
const outputFile = getOutputFile(this.ctx, "json");
|
|
12034
|
+
if (outputFile) {
|
|
12035
|
+
const reportFile = resolve(this.ctx.config.root, outputFile);
|
|
12013
12036
|
const outputDirectory = dirname(reportFile);
|
|
12014
12037
|
if (!existsSync(outputDirectory))
|
|
12015
12038
|
await promises.mkdir(outputDirectory, { recursive: true });
|
|
@@ -12026,6 +12049,19 @@ class VerboseReporter extends DefaultReporter {
|
|
|
12026
12049
|
super();
|
|
12027
12050
|
this.rendererOptions.renderSucceed = true;
|
|
12028
12051
|
}
|
|
12052
|
+
onTaskUpdate(packs) {
|
|
12053
|
+
var _a, _b, _c;
|
|
12054
|
+
if (this.isTTY)
|
|
12055
|
+
return;
|
|
12056
|
+
for (const pack of packs) {
|
|
12057
|
+
const task = this.ctx.state.idMap.get(pack[0]);
|
|
12058
|
+
if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
|
|
12059
|
+
this.ctx.log(` ${getStateSymbol(task)} ${getFullName(task)}`);
|
|
12060
|
+
if (task.result.state === "fail")
|
|
12061
|
+
this.ctx.log(c.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
|
|
12062
|
+
}
|
|
12063
|
+
}
|
|
12064
|
+
}
|
|
12029
12065
|
}
|
|
12030
12066
|
|
|
12031
12067
|
class IndentedLogger {
|
|
@@ -12155,8 +12191,9 @@ function getDuration(task) {
|
|
|
12155
12191
|
class JUnitReporter {
|
|
12156
12192
|
async onInit(ctx) {
|
|
12157
12193
|
this.ctx = ctx;
|
|
12158
|
-
|
|
12159
|
-
|
|
12194
|
+
const outputFile = getOutputFile(this.ctx, "junit");
|
|
12195
|
+
if (outputFile) {
|
|
12196
|
+
this.reportFile = resolve(this.ctx.config.root, outputFile);
|
|
12160
12197
|
const outputDirectory = dirname(this.reportFile);
|
|
12161
12198
|
if (!existsSync(outputDirectory))
|
|
12162
12199
|
await promises.mkdir(outputDirectory, { recursive: true });
|
|
@@ -12625,7 +12662,7 @@ async function printError(error, ctx) {
|
|
|
12625
12662
|
});
|
|
12626
12663
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
12627
12664
|
if (e.showDiff)
|
|
12628
|
-
displayDiff(e.actual, e.expected, ctx.console, ctx.config.outputTruncateLength);
|
|
12665
|
+
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console, ctx.config.outputTruncateLength);
|
|
12629
12666
|
}
|
|
12630
12667
|
const esmErrors = [
|
|
12631
12668
|
"Cannot use import statement outside a module",
|
|
@@ -13454,7 +13491,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
13454
13491
|
await ctx.setServer(options, server);
|
|
13455
13492
|
haveStarted = true;
|
|
13456
13493
|
if (options.api && options.watch)
|
|
13457
|
-
(await import('./chunk-api-setup.
|
|
13494
|
+
(await import('./chunk-api-setup.7290422e.js')).setup(ctx);
|
|
13458
13495
|
if (!options.watch)
|
|
13459
13496
|
await server.watcher.close();
|
|
13460
13497
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import {
|
|
4
|
+
import { l as isAbsolute$2, w as resolve, j as join$2, A as extname$2, k as dirname$2 } from './chunk-utils-global.10dcdfa6.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { c } from './chunk-utils-
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { e as c } from './chunk-utils-global.10dcdfa6.js';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.ddf2a6fb.js';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
@@ -16,13 +16,13 @@ import 'util';
|
|
|
16
16
|
import 'url';
|
|
17
17
|
import 'os';
|
|
18
18
|
import 'vite';
|
|
19
|
-
import './chunk-constants.
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
19
|
+
import './chunk-constants.e59013dc.js';
|
|
20
|
+
import './chunk-vite-node-utils.7f0053fb.js';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'vm';
|
|
23
|
-
import './chunk-defaults.
|
|
23
|
+
import './chunk-defaults.9aa0ce42.js';
|
|
24
24
|
import 'perf_hooks';
|
|
25
|
-
import './chunk-utils-timers.
|
|
25
|
+
import './chunk-utils-timers.4800834c.js';
|
|
26
26
|
import 'worker_threads';
|
|
27
27
|
import 'tinypool';
|
|
28
28
|
import './chunk-magic-string.d5e0e473.js';
|
|
@@ -643,7 +643,7 @@ class CAC extends EventEmitter {
|
|
|
643
643
|
const cac = (name = "") => new CAC(name);
|
|
644
644
|
|
|
645
645
|
const cli = cac("vitest");
|
|
646
|
-
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("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--global", "deprecated, use --globals").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
646
|
+
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("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--global", "deprecated, use --globals").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
647
647
|
cli.command("run [...filters]").action(run);
|
|
648
648
|
cli.command("related [...filters]").action(runRelated);
|
|
649
649
|
cli.command("watch [...filters]").action(start);
|
package/dist/entry.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { t as toArray,
|
|
2
|
+
import { g as getWorkerState, t as toArray, m as relative, D as partitionSuiteChildren, E as hasTests, q as hasFailed, p as getFullName, r as resetModules } from './chunk-utils-global.10dcdfa6.js';
|
|
3
3
|
import { Console } from 'console';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
import { importModule } from 'local-pkg';
|
|
6
|
-
import { r as resetRunOnceCounter, i as index, R as RealDate,
|
|
7
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { t as takeCoverage } from './chunk-defaults.e85b72aa.js';
|
|
6
|
+
import { r as resetRunOnceCounter, i as index, R as RealDate, c as clearContext, d as defaultSuite, s as setHooks, g as getHooks, a as context, b as getSnapshotClient, e as setState, f as getFn, h as getState, v as vi } from './chunk-runtime-chain.94cf66a4.js';
|
|
7
|
+
import { r as rpc } from './chunk-runtime-rpc.4b80b6bd.js';
|
|
8
|
+
import { c as clearTimeout, s as setTimeout, d as stringify } from './chunk-utils-timers.4800834c.js';
|
|
9
|
+
import { t as takeCoverage } from './chunk-defaults.9aa0ce42.js';
|
|
11
10
|
import { createHash } from 'crypto';
|
|
12
11
|
import { format } from 'util';
|
|
13
12
|
import 'path';
|
|
@@ -403,7 +402,7 @@ async function setupGlobalEnv(config) {
|
|
|
403
402
|
globalSetup = true;
|
|
404
403
|
setupConsoleLogSpy();
|
|
405
404
|
if (config.globals)
|
|
406
|
-
(await import('./chunk-integrations-globals.
|
|
405
|
+
(await import('./chunk-integrations-globals.c040aaa9.js')).registerApiGlobally();
|
|
407
406
|
}
|
|
408
407
|
function setupDefines(defines) {
|
|
409
408
|
for (const key in defines)
|
|
@@ -907,8 +906,9 @@ async function run(files, config) {
|
|
|
907
906
|
var _a;
|
|
908
907
|
await setupGlobalEnv(config);
|
|
909
908
|
const workerState = getWorkerState();
|
|
910
|
-
workerState.mockMap.clear();
|
|
911
909
|
for (const file of files) {
|
|
910
|
+
workerState.mockMap.clear();
|
|
911
|
+
resetModules();
|
|
912
912
|
const code = await promises.readFile(file, "utf-8");
|
|
913
913
|
const env = ((_a = code.match(/@(?:vitest|jest)-environment\s+?([\w-]+)\b/)) == null ? void 0 : _a[1]) || config.environment || "node";
|
|
914
914
|
if (!["node", "jsdom", "happy-dom"].includes(env))
|
package/dist/index.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ interface MatcherHintOptions {
|
|
|
108
108
|
secondArgumentColor?: Formatter;
|
|
109
109
|
}
|
|
110
110
|
declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
|
|
111
|
-
declare
|
|
111
|
+
declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
|
|
112
112
|
declare const printReceived: (object: unknown) => string;
|
|
113
113
|
declare const printExpected: (value: unknown) => string;
|
|
114
114
|
interface DiffOptions {
|
|
@@ -434,6 +434,7 @@ declare class JsonReporter implements Reporter {
|
|
|
434
434
|
|
|
435
435
|
declare class VerboseReporter extends DefaultReporter {
|
|
436
436
|
constructor();
|
|
437
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
437
438
|
}
|
|
438
439
|
|
|
439
440
|
declare class TapReporter implements Reporter {
|
|
@@ -699,6 +700,7 @@ interface TaskResult {
|
|
|
699
700
|
duration?: number;
|
|
700
701
|
startTime?: number;
|
|
701
702
|
error?: ErrorWithDiff;
|
|
703
|
+
htmlError?: string;
|
|
702
704
|
hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
|
|
703
705
|
}
|
|
704
706
|
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
@@ -945,8 +947,9 @@ interface InlineConfig {
|
|
|
945
947
|
outputTruncateLength?: number;
|
|
946
948
|
/**
|
|
947
949
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
950
|
+
* Also definable individually per reporter by using an object instead.
|
|
948
951
|
*/
|
|
949
|
-
outputFile?: string;
|
|
952
|
+
outputFile?: string | (Partial<Record<BuiltinReporters, string>> & Record<string, string>);
|
|
950
953
|
/**
|
|
951
954
|
* Enable multi-threading
|
|
952
955
|
*
|
|
@@ -1232,13 +1235,13 @@ interface SpyContext<TArgs, TReturns> {
|
|
|
1232
1235
|
declare type Procedure = (...args: any[]) => any;
|
|
1233
1236
|
declare type Methods<T> = {
|
|
1234
1237
|
[K in keyof T]: T[K] extends Procedure ? K : never;
|
|
1235
|
-
}[keyof T] & string;
|
|
1238
|
+
}[keyof T] & (string | symbol);
|
|
1236
1239
|
declare type Properties<T> = {
|
|
1237
1240
|
[K in keyof T]: T[K] extends Procedure ? never : K;
|
|
1238
|
-
}[keyof T] & string;
|
|
1241
|
+
}[keyof T] & (string | symbol);
|
|
1239
1242
|
declare type Classes<T> = {
|
|
1240
1243
|
[K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
|
|
1241
|
-
}[keyof T] & string;
|
|
1244
|
+
}[keyof T] & (string | symbol);
|
|
1242
1245
|
interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
|
|
1243
1246
|
getMockName(): string;
|
|
1244
1247
|
mockName(n: string): this;
|
|
@@ -1377,6 +1380,7 @@ declare class VitestUtils {
|
|
|
1377
1380
|
* `IntersectionObserver`.
|
|
1378
1381
|
*/
|
|
1379
1382
|
stubGlobal(name: string | symbol | number, value: any): this;
|
|
1383
|
+
resetModules(): this;
|
|
1380
1384
|
}
|
|
1381
1385
|
declare const vitest: VitestUtils;
|
|
1382
1386
|
declare const vi: VitestUtils;
|
|
@@ -1507,4 +1511,4 @@ declare global {
|
|
|
1507
1511
|
}
|
|
1508
1512
|
}
|
|
1509
1513
|
|
|
1510
|
-
export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, MergeInsertions, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyContext, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest };
|
|
1514
|
+
export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, MergeInsertions, MockedFunction, MockedObject, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyContext, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { p as afterAll, u as afterEach, o as beforeAll, q as beforeEach, k as describe, w as expect, y as getRunningMode, n as isFirstRun, z as isWatchMode, l as it, m as runOnce, j as suite, t as test, v as vi, x as vitest } from './chunk-runtime-chain.94cf66a4.js';
|
|
2
2
|
export { assert, default as chai, should } from 'chai';
|
|
3
3
|
import 'util';
|
|
4
|
-
import './chunk-utils-
|
|
4
|
+
import './chunk-utils-global.10dcdfa6.js';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
|
-
import './chunk-utils-
|
|
9
|
-
import './chunk-utils-timers.5657f2a4.js';
|
|
8
|
+
import './chunk-utils-timers.4800834c.js';
|
|
10
9
|
import './vendor-_commonjsHelpers.34b404ce.js';
|
|
11
|
-
import './chunk-runtime-rpc.
|
|
10
|
+
import './chunk-runtime-rpc.4b80b6bd.js';
|
|
12
11
|
import 'fs';
|
|
13
12
|
import './spy.js';
|
|
14
13
|
import 'tinyspy';
|
package/dist/node.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ declare class JsonReporter implements Reporter {
|
|
|
280
280
|
|
|
281
281
|
declare class VerboseReporter extends DefaultReporter {
|
|
282
282
|
constructor();
|
|
283
|
+
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
declare class TapReporter implements Reporter {
|
|
@@ -509,6 +510,7 @@ interface TaskResult {
|
|
|
509
510
|
duration?: number;
|
|
510
511
|
startTime?: number;
|
|
511
512
|
error?: ErrorWithDiff;
|
|
513
|
+
htmlError?: string;
|
|
512
514
|
hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
|
|
513
515
|
}
|
|
514
516
|
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
@@ -698,8 +700,9 @@ interface InlineConfig {
|
|
|
698
700
|
outputTruncateLength?: number;
|
|
699
701
|
/**
|
|
700
702
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
703
|
+
* Also definable individually per reporter by using an object instead.
|
|
701
704
|
*/
|
|
702
|
-
outputFile?: string;
|
|
705
|
+
outputFile?: string | (Partial<Record<BuiltinReporters, string>> & Record<string, string>);
|
|
703
706
|
/**
|
|
704
707
|
* Enable multi-threading
|
|
705
708
|
*
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.ddf2a6fb.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.7f4b1850.js';
|
|
3
3
|
import 'buffer';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'child_process';
|
|
@@ -13,20 +13,19 @@ import 'stream';
|
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'url';
|
|
15
15
|
import 'os';
|
|
16
|
-
import './chunk-utils-
|
|
16
|
+
import './chunk-utils-global.10dcdfa6.js';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'vite';
|
|
20
|
-
import './chunk-constants.
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-constants.e59013dc.js';
|
|
21
|
+
import './chunk-vite-node-utils.7f0053fb.js';
|
|
22
22
|
import 'module';
|
|
23
23
|
import 'vm';
|
|
24
|
-
import './chunk-defaults.
|
|
24
|
+
import './chunk-defaults.9aa0ce42.js';
|
|
25
25
|
import 'perf_hooks';
|
|
26
|
-
import './chunk-utils-timers.
|
|
26
|
+
import './chunk-utils-timers.4800834c.js';
|
|
27
27
|
import 'worker_threads';
|
|
28
28
|
import 'tinypool';
|
|
29
29
|
import './chunk-magic-string.d5e0e473.js';
|
|
30
30
|
import 'readline';
|
|
31
31
|
import './vendor-index.ee829ed6.js';
|
|
32
|
-
import './chunk-utils-global.7bcfa03c.js';
|
package/dist/worker.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.
|
|
3
|
-
import { d as distDir } from './chunk-constants.
|
|
4
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
-
import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
|
|
1
|
+
import { w as resolve, g as getWorkerState } from './chunk-utils-global.10dcdfa6.js';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.7f0053fb.js';
|
|
3
|
+
import { d as distDir } from './chunk-constants.e59013dc.js';
|
|
4
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.7f4b1850.js';
|
|
5
|
+
import { r as rpc } from './chunk-runtime-rpc.4b80b6bd.js';
|
|
7
6
|
import 'path';
|
|
8
7
|
import 'tty';
|
|
9
8
|
import 'local-pkg';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.2",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vite",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"chai": "^4.3.6",
|
|
81
81
|
"local-pkg": "^0.4.1",
|
|
82
82
|
"tinypool": "^0.1.2",
|
|
83
|
-
"tinyspy": "^0.3.
|
|
83
|
+
"tinyspy": "^0.3.2",
|
|
84
84
|
"vite": "^2.9.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@types/node": "^17.0.23",
|
|
94
94
|
"@types/prompts": "^2.4.0",
|
|
95
95
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
96
|
-
"@vitest/ui": "0.
|
|
96
|
+
"@vitest/ui": "0.9.2",
|
|
97
97
|
"birpc": "^0.2.2",
|
|
98
98
|
"c8": "^7.11.0",
|
|
99
99
|
"cac": "^6.7.12",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"source-map-js": "^1.0.2",
|
|
121
121
|
"strip-ansi": "^7.0.1",
|
|
122
122
|
"typescript": "^4.6.3",
|
|
123
|
-
"vite-node": "0.
|
|
123
|
+
"vite-node": "0.9.2",
|
|
124
124
|
"ws": "^8.5.0"
|
|
125
125
|
},
|
|
126
126
|
"engines": {
|