vitest 0.0.122 → 0.0.123
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 +5 -5
- package/dist/{constants-22bbd600.js → constants-744cb76d.js} +1 -1
- package/dist/{diff-a295cb37.js → diff-a0cbb825.js} +1 -1
- package/dist/entry.js +14 -15
- package/dist/externalize-2f63779d.js +9258 -0
- package/dist/{global-71c4f178.js → global-f9288768.js} +4 -4
- package/dist/{index-090545ef.js → index-250bdca0.js} +2 -5
- package/dist/{index-3cd686b2.js → index-68c0c743.js} +1 -1
- package/dist/{index-123a18df.js → index-a7ae9662.js} +24 -16
- package/dist/index.d.ts +27 -8
- package/dist/index.js +3 -3
- package/dist/node.d.ts +19 -5
- package/dist/node.js +4 -4
- package/dist/{setup-c9c7cb5b.js → setup-647e44ef.js} +35 -2
- package/dist/{vi-c99184a5.js → vi-aef0a94d.js} +5 -7
- package/dist/worker.js +25 -9242
- package/package.json +9 -4
- package/dist/utils.js +0 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { g as globalApis } from './constants-
|
|
2
|
-
import { i as index } from './index-
|
|
1
|
+
import { g as globalApis } from './constants-744cb76d.js';
|
|
2
|
+
import { i as index } from './index-68c0c743.js';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './index-
|
|
4
|
+
import './index-250bdca0.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
|
-
import './vi-
|
|
8
|
+
import './vi-aef0a94d.js';
|
|
9
9
|
import './_commonjsHelpers-c9e3b764.js';
|
|
10
10
|
import './jest-mock-038a01b3.js';
|
|
11
11
|
import 'chai';
|
|
@@ -271,7 +271,7 @@ function partitionSuiteChildren(suite) {
|
|
|
271
271
|
let tasksGroup = [];
|
|
272
272
|
const tasksGroups = [];
|
|
273
273
|
for (const c2 of suite.tasks) {
|
|
274
|
-
if (tasksGroup.length === 0 || c2.
|
|
274
|
+
if (tasksGroup.length === 0 || c2.concurrent === tasksGroup[0].concurrent) {
|
|
275
275
|
tasksGroup.push(c2);
|
|
276
276
|
} else {
|
|
277
277
|
tasksGroups.push(tasksGroup);
|
|
@@ -285,9 +285,6 @@ function partitionSuiteChildren(suite) {
|
|
|
285
285
|
function getTests(suite) {
|
|
286
286
|
return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c2) => c2.type === "test" ? [c2] : getTests(c2)));
|
|
287
287
|
}
|
|
288
|
-
function getTasks(tasks) {
|
|
289
|
-
return toArray(tasks).flatMap((s) => s.type === "test" ? [s] : [s, ...getTasks(s.tasks)]);
|
|
290
|
-
}
|
|
291
288
|
function getSuites(suite) {
|
|
292
289
|
return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
|
|
293
290
|
}
|
|
@@ -365,4 +362,4 @@ function toFilePath(id, root) {
|
|
|
365
362
|
return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
|
|
366
363
|
}
|
|
367
364
|
|
|
368
|
-
export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, join as q, relative as r, slash as s, toArray as t, index as u, getNames as v, partitionSuiteChildren as w, hasTests as x
|
|
365
|
+
export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, join as q, relative as r, slash as s, toArray as t, index as u, getNames as v, partitionSuiteChildren as w, hasTests as x };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-aef0a94d.js';
|
|
2
2
|
import chai, { assert, should } from 'chai';
|
|
3
3
|
import { s as spies, a as spyOn, f as fn } from './jest-mock-038a01b3.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1 } from './index-
|
|
1
|
+
import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1, e as ensurePackageInstalled } from './index-250bdca0.js';
|
|
2
2
|
import { createServer, mergeConfig } from 'vite';
|
|
3
3
|
import path$a from 'path';
|
|
4
4
|
import process$1 from 'process';
|
|
@@ -7,10 +7,10 @@ import require$$0 from 'os';
|
|
|
7
7
|
import require$$0$1 from 'util';
|
|
8
8
|
import require$$0$2 from 'stream';
|
|
9
9
|
import require$$2 from 'events';
|
|
10
|
-
import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-
|
|
10
|
+
import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-744cb76d.js';
|
|
11
11
|
import MagicString from './magic-string.es-94000aea.js';
|
|
12
12
|
import { performance } from 'perf_hooks';
|
|
13
|
-
import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-
|
|
13
|
+
import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-a0cbb825.js';
|
|
14
14
|
import { o as onetime, s as signalExit } from './index-648e7ab2.js';
|
|
15
15
|
import { createRequire } from 'module';
|
|
16
16
|
import { pathToFileURL } from 'url';
|
|
@@ -6840,7 +6840,7 @@ const MocksPlugin = () => {
|
|
|
6840
6840
|
if (m) {
|
|
6841
6841
|
return {
|
|
6842
6842
|
code: m.toString(),
|
|
6843
|
-
map: m.generateMap()
|
|
6843
|
+
map: m.generateMap({ hires: true })
|
|
6844
6844
|
};
|
|
6845
6845
|
}
|
|
6846
6846
|
}
|
|
@@ -7058,9 +7058,9 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
|
|
|
7058
7058
|
await this.printTaskErrors(failedTests, errorDivider);
|
|
7059
7059
|
}
|
|
7060
7060
|
const executionTime = this.end - this.start;
|
|
7061
|
-
const threadTime =
|
|
7061
|
+
const threadTime = files.reduce((acc, test) => {
|
|
7062
7062
|
var _a;
|
|
7063
|
-
return acc + (((_a = test.result) == null ? void 0 : _a.
|
|
7063
|
+
return acc + (((_a = test.result) == null ? void 0 : _a.duration) || 0) + (test.collectDuration || 0);
|
|
7064
7064
|
}, 0);
|
|
7065
7065
|
const padTitle = (str) => c.dim(`${str.padStart(10)} `);
|
|
7066
7066
|
const time = (time2) => {
|
|
@@ -7618,10 +7618,9 @@ function renderTree(tasks, options, level = 0) {
|
|
|
7618
7618
|
suffix += c.dim(` (${getTests(task).length})`);
|
|
7619
7619
|
if (task.mode === "skip" || task.mode === "todo")
|
|
7620
7620
|
suffix += ` ${c.dim(c.gray("[skipped]"))}`;
|
|
7621
|
-
if ((_a = task.result) == null ? void 0 : _a.
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
suffix += c.yellow(` ${Math.round(duration)}${c.dim("ms")}`);
|
|
7621
|
+
if (((_a = task.result) == null ? void 0 : _a.duration) != null) {
|
|
7622
|
+
if (task.result.duration > DURATION_LONG)
|
|
7623
|
+
suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
|
|
7625
7624
|
}
|
|
7626
7625
|
let name = task.name;
|
|
7627
7626
|
if (level === 0)
|
|
@@ -7946,7 +7945,7 @@ var __spreadValues = (a, b) => {
|
|
|
7946
7945
|
};
|
|
7947
7946
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
7948
7947
|
function resolveConfig(options, viteConfig) {
|
|
7949
|
-
var _a, _b;
|
|
7948
|
+
var _a, _b, _c, _d;
|
|
7950
7949
|
if (options.dom)
|
|
7951
7950
|
options.environment = "happy-dom";
|
|
7952
7951
|
const resolved = __spreadProps(__spreadValues({}, deepMerge(options, viteConfig.test)), {
|
|
@@ -7955,9 +7954,10 @@ function resolveConfig(options, viteConfig) {
|
|
|
7955
7954
|
resolved.coverage = resolveC8Options(resolved.coverage, resolved.root);
|
|
7956
7955
|
resolved.depsInline = [...((_a = resolved.deps) == null ? void 0 : _a.inline) || []];
|
|
7957
7956
|
resolved.depsExternal = [...((_b = resolved.deps) == null ? void 0 : _b.external) || []];
|
|
7957
|
+
resolved.fallbackCJS = ((_c = resolved.deps) == null ? void 0 : _c.fallbackCJS) ?? true;
|
|
7958
|
+
resolved.interpretDefault = ((_d = resolved.deps) == null ? void 0 : _d.interpretDefault) ?? true;
|
|
7958
7959
|
resolved.environment = resolved.environment || "node";
|
|
7959
7960
|
resolved.threads = resolved.threads ?? true;
|
|
7960
|
-
resolved.interpretDefault = resolved.interpretDefault ?? true;
|
|
7961
7961
|
resolved.clearMocks = resolved.clearMocks ?? false;
|
|
7962
7962
|
resolved.restoreMocks = resolved.restoreMocks ?? false;
|
|
7963
7963
|
resolved.mockReset = resolved.mockReset ?? false;
|
|
@@ -8345,6 +8345,12 @@ async function createVitest(options, viteOverrides = {}) {
|
|
|
8345
8345
|
const root = resolve(options.root || process.cwd());
|
|
8346
8346
|
const configPath = options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
|
|
8347
8347
|
let haveStarted = false;
|
|
8348
|
+
async function UIPlugin() {
|
|
8349
|
+
if (!options.open)
|
|
8350
|
+
return;
|
|
8351
|
+
await ensurePackageInstalled("@vitest/ui");
|
|
8352
|
+
return (await import('@vitest/ui')).default();
|
|
8353
|
+
}
|
|
8348
8354
|
const config = {
|
|
8349
8355
|
root,
|
|
8350
8356
|
logLevel: "error",
|
|
@@ -8359,14 +8365,16 @@ async function createVitest(options, viteOverrides = {}) {
|
|
|
8359
8365
|
await ctx.setServer(options, server2);
|
|
8360
8366
|
haveStarted = true;
|
|
8361
8367
|
if (options.api)
|
|
8362
|
-
(await import('./setup-
|
|
8368
|
+
(await import('./setup-647e44ef.js')).setup(ctx);
|
|
8363
8369
|
}
|
|
8364
8370
|
},
|
|
8365
|
-
MocksPlugin()
|
|
8371
|
+
MocksPlugin(),
|
|
8372
|
+
await UIPlugin()
|
|
8366
8373
|
],
|
|
8367
8374
|
server: {
|
|
8368
|
-
open: options.open,
|
|
8369
|
-
strictPort: true
|
|
8375
|
+
open: options.open ? "/__vitest__/" : void 0,
|
|
8376
|
+
strictPort: true,
|
|
8377
|
+
preTransformRequests: false
|
|
8370
8378
|
},
|
|
8371
8379
|
build: {
|
|
8372
8380
|
sourcemap: true
|
package/dist/index.d.ts
CHANGED
|
@@ -379,20 +379,18 @@ declare type ChainableFunction<T extends string, Args extends any[], R = any> =
|
|
|
379
379
|
|
|
380
380
|
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
381
381
|
declare type TaskState = RunMode | 'pass' | 'fail';
|
|
382
|
-
declare type ComputeMode = 'serial' | 'concurrent';
|
|
383
382
|
interface TaskBase {
|
|
384
383
|
id: string;
|
|
385
384
|
name: string;
|
|
386
385
|
mode: RunMode;
|
|
387
|
-
|
|
386
|
+
concurrent?: boolean;
|
|
388
387
|
suite?: Suite;
|
|
389
388
|
file?: File;
|
|
390
389
|
result?: TaskResult;
|
|
391
390
|
}
|
|
392
391
|
interface TaskResult {
|
|
393
392
|
state: TaskState;
|
|
394
|
-
|
|
395
|
-
end?: number;
|
|
393
|
+
duration?: number;
|
|
396
394
|
error?: unknown;
|
|
397
395
|
}
|
|
398
396
|
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
@@ -402,6 +400,7 @@ interface Suite extends TaskBase {
|
|
|
402
400
|
}
|
|
403
401
|
interface File extends Suite {
|
|
404
402
|
filepath: string;
|
|
403
|
+
collectDuration?: number;
|
|
405
404
|
}
|
|
406
405
|
interface Test extends TaskBase {
|
|
407
406
|
type: 'test';
|
|
@@ -529,6 +528,20 @@ interface InlineConfig {
|
|
|
529
528
|
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
530
529
|
*/
|
|
531
530
|
inline?: (string | RegExp)[];
|
|
531
|
+
/**
|
|
532
|
+
* Interpret CJS module's default as named exports
|
|
533
|
+
*
|
|
534
|
+
* @default true
|
|
535
|
+
*/
|
|
536
|
+
interpretDefault?: boolean;
|
|
537
|
+
/**
|
|
538
|
+
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
539
|
+
* This will significantly improve the performance in huge repo, but might potentially
|
|
540
|
+
* cause some misalignment if a package have different logic in ESM and CJS mode.
|
|
541
|
+
*
|
|
542
|
+
* @default true
|
|
543
|
+
*/
|
|
544
|
+
fallbackCJS?: boolean;
|
|
532
545
|
};
|
|
533
546
|
/**
|
|
534
547
|
* Register apis globally
|
|
@@ -582,7 +595,6 @@ interface InlineConfig {
|
|
|
582
595
|
* @default available CPUs
|
|
583
596
|
*/
|
|
584
597
|
minThreads?: number;
|
|
585
|
-
interpretDefault?: boolean;
|
|
586
598
|
/**
|
|
587
599
|
* Default timeout of a test in milliseconds
|
|
588
600
|
*
|
|
@@ -690,6 +702,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
690
702
|
findRelatedTests?: string[];
|
|
691
703
|
depsInline: (string | RegExp)[];
|
|
692
704
|
depsExternal: (string | RegExp)[];
|
|
705
|
+
fallbackCJS: boolean;
|
|
706
|
+
interpretDefault: boolean;
|
|
693
707
|
coverage: ResolvedC8Options;
|
|
694
708
|
snapshotOptions: SnapshotStateOptions;
|
|
695
709
|
}
|
|
@@ -710,9 +724,9 @@ interface WorkerRPC {
|
|
|
710
724
|
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
711
725
|
}
|
|
712
726
|
|
|
713
|
-
declare const suite: ChainableFunction<"
|
|
727
|
+
declare const suite: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
|
|
714
728
|
declare const test: TestCollector;
|
|
715
|
-
declare const describe: ChainableFunction<"
|
|
729
|
+
declare const describe: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
|
|
716
730
|
declare const it: TestCollector;
|
|
717
731
|
|
|
718
732
|
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
|
|
@@ -883,6 +897,11 @@ interface WebSocketHandlers {
|
|
|
883
897
|
getFiles(): File[];
|
|
884
898
|
getConfig(): ResolvedConfig;
|
|
885
899
|
getSourceCode(id: string): Promise<string>;
|
|
900
|
+
getModuleGraph(id: string): Promise<{
|
|
901
|
+
graph: Record<string, string[]>;
|
|
902
|
+
externalized: string[];
|
|
903
|
+
inlined: string[];
|
|
904
|
+
}>;
|
|
886
905
|
rerun(files: string[]): Promise<void>;
|
|
887
906
|
}
|
|
888
907
|
interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onTaskUpdate'> {
|
|
@@ -977,4 +996,4 @@ declare global {
|
|
|
977
996
|
}
|
|
978
997
|
}
|
|
979
998
|
|
|
980
|
-
export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment,
|
|
999
|
+
export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ConstructorArgumentsOf, DoneCallback, EnhancedSpy, Environment, EnvironmentReturn, File, HookListener, InlineConfig, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MethodKeysOf, MockWithArgs, MockableFunction, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, Nullable, ParsedStack, Position, PropertyKeysOf, Reporter, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-
|
|
1
|
+
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-aef0a94d.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-68c0c743.js';
|
|
3
3
|
export { f as fn, s as spies, a as spyOn } from './jest-mock-038a01b3.js';
|
|
4
4
|
export { assert, default as chai, should } from 'chai';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-250bdca0.js';
|
|
6
6
|
import 'url';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'local-pkg';
|
package/dist/node.d.ts
CHANGED
|
@@ -125,20 +125,18 @@ interface UserConsoleLog {
|
|
|
125
125
|
|
|
126
126
|
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
127
127
|
declare type TaskState = RunMode | 'pass' | 'fail';
|
|
128
|
-
declare type ComputeMode = 'serial' | 'concurrent';
|
|
129
128
|
interface TaskBase {
|
|
130
129
|
id: string;
|
|
131
130
|
name: string;
|
|
132
131
|
mode: RunMode;
|
|
133
|
-
|
|
132
|
+
concurrent?: boolean;
|
|
134
133
|
suite?: Suite;
|
|
135
134
|
file?: File;
|
|
136
135
|
result?: TaskResult;
|
|
137
136
|
}
|
|
138
137
|
interface TaskResult {
|
|
139
138
|
state: TaskState;
|
|
140
|
-
|
|
141
|
-
end?: number;
|
|
139
|
+
duration?: number;
|
|
142
140
|
error?: unknown;
|
|
143
141
|
}
|
|
144
142
|
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
|
|
@@ -148,6 +146,7 @@ interface Suite extends TaskBase {
|
|
|
148
146
|
}
|
|
149
147
|
interface File extends Suite {
|
|
150
148
|
filepath: string;
|
|
149
|
+
collectDuration?: number;
|
|
151
150
|
}
|
|
152
151
|
interface Test extends TaskBase {
|
|
153
152
|
type: 'test';
|
|
@@ -237,6 +236,20 @@ interface InlineConfig {
|
|
|
237
236
|
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
238
237
|
*/
|
|
239
238
|
inline?: (string | RegExp)[];
|
|
239
|
+
/**
|
|
240
|
+
* Interpret CJS module's default as named exports
|
|
241
|
+
*
|
|
242
|
+
* @default true
|
|
243
|
+
*/
|
|
244
|
+
interpretDefault?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
247
|
+
* This will significantly improve the performance in huge repo, but might potentially
|
|
248
|
+
* cause some misalignment if a package have different logic in ESM and CJS mode.
|
|
249
|
+
*
|
|
250
|
+
* @default true
|
|
251
|
+
*/
|
|
252
|
+
fallbackCJS?: boolean;
|
|
240
253
|
};
|
|
241
254
|
/**
|
|
242
255
|
* Register apis globally
|
|
@@ -290,7 +303,6 @@ interface InlineConfig {
|
|
|
290
303
|
* @default available CPUs
|
|
291
304
|
*/
|
|
292
305
|
minThreads?: number;
|
|
293
|
-
interpretDefault?: boolean;
|
|
294
306
|
/**
|
|
295
307
|
* Default timeout of a test in milliseconds
|
|
296
308
|
*
|
|
@@ -398,6 +410,8 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
398
410
|
findRelatedTests?: string[];
|
|
399
411
|
depsInline: (string | RegExp)[];
|
|
400
412
|
depsExternal: (string | RegExp)[];
|
|
413
|
+
fallbackCJS: boolean;
|
|
414
|
+
interpretDefault: boolean;
|
|
401
415
|
coverage: ResolvedC8Options;
|
|
402
416
|
snapshotOptions: SnapshotStateOptions;
|
|
403
417
|
}
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { c as createVitest } from './index-
|
|
2
|
-
import './index-
|
|
1
|
+
export { c as createVitest } from './index-a7ae9662.js';
|
|
2
|
+
import './index-250bdca0.js';
|
|
3
3
|
import 'url';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
@@ -11,10 +11,10 @@ import 'os';
|
|
|
11
11
|
import 'util';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'events';
|
|
14
|
-
import './constants-
|
|
14
|
+
import './constants-744cb76d.js';
|
|
15
15
|
import './magic-string.es-94000aea.js';
|
|
16
16
|
import 'perf_hooks';
|
|
17
|
-
import './diff-
|
|
17
|
+
import './diff-a0cbb825.js';
|
|
18
18
|
import './index-648e7ab2.js';
|
|
19
19
|
import './_commonjsHelpers-c9e3b764.js';
|
|
20
20
|
import 'assert';
|
|
@@ -9,11 +9,15 @@ import require$$2 from 'events';
|
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
11
|
import require$$7 from 'url';
|
|
12
|
-
import { A as API_PATH } from './constants-
|
|
13
|
-
import './
|
|
12
|
+
import { A as API_PATH } from './constants-744cb76d.js';
|
|
13
|
+
import { s as shouldExternalize } from './externalize-2f63779d.js';
|
|
14
|
+
import './index-250bdca0.js';
|
|
14
15
|
import 'tty';
|
|
15
16
|
import 'local-pkg';
|
|
16
17
|
import 'path';
|
|
18
|
+
import 'module';
|
|
19
|
+
import 'assert';
|
|
20
|
+
import 'util';
|
|
17
21
|
|
|
18
22
|
/*! (c) 2020 Andrea Giammarchi */
|
|
19
23
|
|
|
@@ -4276,6 +4280,35 @@ function setup(ctx) {
|
|
|
4276
4280
|
},
|
|
4277
4281
|
getConfig() {
|
|
4278
4282
|
return ctx.config;
|
|
4283
|
+
},
|
|
4284
|
+
async getModuleGraph(id) {
|
|
4285
|
+
const graph = {};
|
|
4286
|
+
function clearId(id2) {
|
|
4287
|
+
return (id2 == null ? void 0 : id2.replace(/\?v=\w+$/, "")) || "";
|
|
4288
|
+
}
|
|
4289
|
+
function get(mod, seen = new Set()) {
|
|
4290
|
+
if (!mod || !mod.id || seen.has(mod))
|
|
4291
|
+
return;
|
|
4292
|
+
seen.add(mod);
|
|
4293
|
+
const mods = Array.from(mod.importedModules).filter((i) => i.id && !i.id.includes("/vitest/dist/"));
|
|
4294
|
+
graph[clearId(mod.id)] = mods.map((i) => clearId(i.id));
|
|
4295
|
+
mods.forEach((m) => get(m, seen));
|
|
4296
|
+
}
|
|
4297
|
+
get(ctx.server.moduleGraph.getModuleById(id));
|
|
4298
|
+
const externalized = [];
|
|
4299
|
+
const inlined = [];
|
|
4300
|
+
await Promise.all(Object.keys(graph).map(async (i) => {
|
|
4301
|
+
const rewrote = await shouldExternalize(i, ctx.config);
|
|
4302
|
+
if (rewrote)
|
|
4303
|
+
externalized.push(rewrote);
|
|
4304
|
+
else
|
|
4305
|
+
inlined.push(i);
|
|
4306
|
+
}));
|
|
4307
|
+
return {
|
|
4308
|
+
graph,
|
|
4309
|
+
externalized,
|
|
4310
|
+
inlined
|
|
4311
|
+
};
|
|
4279
4312
|
}
|
|
4280
4313
|
},
|
|
4281
4314
|
post(msg) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as noop, i as isObject } from './index-
|
|
1
|
+
import { n as noop, i as isObject } from './index-250bdca0.js';
|
|
2
2
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
|
|
3
3
|
import { a as spyOn, f as fn, s as spies } from './jest-mock-038a01b3.js';
|
|
4
4
|
|
|
@@ -125,23 +125,23 @@ function createSuiteHooks() {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
function createSuiteCollector(name, factory = () => {
|
|
128
|
-
}, mode,
|
|
128
|
+
}, mode, concurrent) {
|
|
129
129
|
const tasks = [];
|
|
130
130
|
const factoryQueue = [];
|
|
131
131
|
let suite2;
|
|
132
132
|
initSuite();
|
|
133
133
|
const test2 = createChainable(["concurrent", "skip", "only", "todo", "fails"], function(name2, fn, timeout) {
|
|
134
134
|
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
135
|
-
const computeMode = this.concurrent ? "concurrent" : void 0;
|
|
136
135
|
const test3 = {
|
|
137
136
|
id: "",
|
|
138
137
|
type: "test",
|
|
139
138
|
name: name2,
|
|
140
139
|
mode: mode2,
|
|
141
|
-
computeMode: computeMode ?? (suiteComputeMode ?? "serial"),
|
|
142
140
|
suite: void 0,
|
|
143
141
|
fails: this.fails
|
|
144
142
|
};
|
|
143
|
+
if (this.concurrent || concurrent)
|
|
144
|
+
test3.concurrent = true;
|
|
145
145
|
setFn(test3, normalizeTest(fn || noop, timeout));
|
|
146
146
|
tasks.push(test3);
|
|
147
147
|
});
|
|
@@ -162,7 +162,6 @@ function createSuiteCollector(name, factory = () => {
|
|
|
162
162
|
suite2 = {
|
|
163
163
|
id: "",
|
|
164
164
|
type: "suite",
|
|
165
|
-
computeMode: "serial",
|
|
166
165
|
name,
|
|
167
166
|
mode,
|
|
168
167
|
tasks: []
|
|
@@ -194,8 +193,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
194
193
|
function createSuite() {
|
|
195
194
|
return createChainable(["concurrent", "skip", "only", "todo"], function(name, factory) {
|
|
196
195
|
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
197
|
-
|
|
198
|
-
return createSuiteCollector(name, factory, mode, computeMode);
|
|
196
|
+
return createSuiteCollector(name, factory, mode, this.concurrent);
|
|
199
197
|
});
|
|
200
198
|
}
|
|
201
199
|
|