vitest 0.0.113 → 0.0.114

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.
@@ -0,0 +1,360 @@
1
+ import { fileURLToPath, pathToFileURL } from 'url';
2
+ import require$$0 from 'tty';
3
+ import { isPackageExists } from 'local-pkg';
4
+ import path from 'path';
5
+
6
+ var picocolors = {exports: {}};
7
+
8
+ let tty = require$$0;
9
+
10
+ let isColorSupported =
11
+ !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
12
+ ("FORCE_COLOR" in process.env ||
13
+ process.argv.includes("--color") ||
14
+ process.platform === "win32" ||
15
+ (tty.isatty(1) && process.env.TERM !== "dumb") ||
16
+ "CI" in process.env);
17
+
18
+ let formatter =
19
+ (open, close, replace = open) =>
20
+ input => {
21
+ let string = "" + input;
22
+ let index = string.indexOf(close, open.length);
23
+ return ~index
24
+ ? open + replaceClose(string, close, replace, index) + close
25
+ : open + string + close
26
+ };
27
+
28
+ let replaceClose = (string, close, replace, index) => {
29
+ let start = string.substring(0, index) + replace;
30
+ let end = string.substring(index + close.length);
31
+ let nextIndex = end.indexOf(close);
32
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
33
+ };
34
+
35
+ let createColors = (enabled = isColorSupported) => ({
36
+ isColorSupported: enabled,
37
+ reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
38
+ bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
39
+ dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
40
+ italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
41
+ underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
42
+ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
43
+ hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
44
+ strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
45
+ black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
46
+ red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
47
+ green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
48
+ yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
49
+ blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
50
+ magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
51
+ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
52
+ white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
53
+ gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
54
+ bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
55
+ bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
56
+ bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
57
+ bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
58
+ bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
59
+ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
60
+ bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
61
+ bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
62
+ });
63
+
64
+ picocolors.exports = createColors();
65
+ picocolors.exports.createColors = createColors;
66
+
67
+ var c = picocolors.exports;
68
+
69
+ function normalizeWindowsPath(input = "") {
70
+ if (!input.includes("\\")) {
71
+ return input;
72
+ }
73
+ return input.replace(/\\/g, "/");
74
+ }
75
+
76
+ const _UNC_REGEX = /^[/][/]/;
77
+ const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
78
+ const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
79
+ const sep = "/";
80
+ const delimiter = ":";
81
+ const normalize = function(path2) {
82
+ if (path2.length === 0) {
83
+ return ".";
84
+ }
85
+ path2 = normalizeWindowsPath(path2);
86
+ const isUNCPath = path2.match(_UNC_REGEX);
87
+ const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
88
+ const isPathAbsolute = isAbsolute(path2);
89
+ const trailingSeparator = path2[path2.length - 1] === "/";
90
+ path2 = normalizeString(path2, !isPathAbsolute);
91
+ if (path2.length === 0) {
92
+ if (isPathAbsolute) {
93
+ return "/";
94
+ }
95
+ return trailingSeparator ? "./" : ".";
96
+ }
97
+ if (trailingSeparator) {
98
+ path2 += "/";
99
+ }
100
+ if (isUNCPath) {
101
+ if (hasUNCDrive) {
102
+ return `//./${path2}`;
103
+ }
104
+ return `//${path2}`;
105
+ }
106
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
107
+ };
108
+ const join = function(...args) {
109
+ if (args.length === 0) {
110
+ return ".";
111
+ }
112
+ let joined;
113
+ for (let i = 0; i < args.length; ++i) {
114
+ const arg = args[i];
115
+ if (arg.length > 0) {
116
+ if (joined === void 0) {
117
+ joined = arg;
118
+ } else {
119
+ joined += `/${arg}`;
120
+ }
121
+ }
122
+ }
123
+ if (joined === void 0) {
124
+ return ".";
125
+ }
126
+ return normalize(joined);
127
+ };
128
+ const resolve = function(...args) {
129
+ args = args.map((arg) => normalizeWindowsPath(arg));
130
+ let resolvedPath = "";
131
+ let resolvedAbsolute = false;
132
+ for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
133
+ const path2 = i >= 0 ? args[i] : process.cwd();
134
+ if (path2.length === 0) {
135
+ continue;
136
+ }
137
+ resolvedPath = `${path2}/${resolvedPath}`;
138
+ resolvedAbsolute = isAbsolute(path2);
139
+ }
140
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
141
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
142
+ return `/${resolvedPath}`;
143
+ }
144
+ return resolvedPath.length > 0 ? resolvedPath : ".";
145
+ };
146
+ function normalizeString(path2, allowAboveRoot) {
147
+ let res = "";
148
+ let lastSegmentLength = 0;
149
+ let lastSlash = -1;
150
+ let dots = 0;
151
+ let char = null;
152
+ for (let i = 0; i <= path2.length; ++i) {
153
+ if (i < path2.length) {
154
+ char = path2[i];
155
+ } else if (char === "/") {
156
+ break;
157
+ } else {
158
+ char = "/";
159
+ }
160
+ if (char === "/") {
161
+ if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
162
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
163
+ if (res.length > 2) {
164
+ const lastSlashIndex = res.lastIndexOf("/");
165
+ if (lastSlashIndex === -1) {
166
+ res = "";
167
+ lastSegmentLength = 0;
168
+ } else {
169
+ res = res.slice(0, lastSlashIndex);
170
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
171
+ }
172
+ lastSlash = i;
173
+ dots = 0;
174
+ continue;
175
+ } else if (res.length !== 0) {
176
+ res = "";
177
+ lastSegmentLength = 0;
178
+ lastSlash = i;
179
+ dots = 0;
180
+ continue;
181
+ }
182
+ }
183
+ if (allowAboveRoot) {
184
+ res += res.length > 0 ? "/.." : "..";
185
+ lastSegmentLength = 2;
186
+ }
187
+ } else {
188
+ if (res.length > 0) {
189
+ res += `/${path2.slice(lastSlash + 1, i)}`;
190
+ } else {
191
+ res = path2.slice(lastSlash + 1, i);
192
+ }
193
+ lastSegmentLength = i - lastSlash - 1;
194
+ }
195
+ lastSlash = i;
196
+ dots = 0;
197
+ } else if (char === "." && dots !== -1) {
198
+ ++dots;
199
+ } else {
200
+ dots = -1;
201
+ }
202
+ }
203
+ return res;
204
+ }
205
+ const isAbsolute = function(p) {
206
+ return _IS_ABSOLUTE_RE.test(p);
207
+ };
208
+ const toNamespacedPath = function(p) {
209
+ return normalizeWindowsPath(p);
210
+ };
211
+ const extname = function(p) {
212
+ return path.posix.extname(normalizeWindowsPath(p));
213
+ };
214
+ const relative = function(from, to) {
215
+ return path.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
216
+ };
217
+ const dirname = function(p) {
218
+ return path.posix.dirname(normalizeWindowsPath(p));
219
+ };
220
+ const format = function(p) {
221
+ return normalizeWindowsPath(path.posix.format(p));
222
+ };
223
+ const basename = function(p, ext) {
224
+ return path.posix.basename(normalizeWindowsPath(p), ext);
225
+ };
226
+ const parse = function(p) {
227
+ return path.posix.parse(normalizeWindowsPath(p));
228
+ };
229
+
230
+ const _path = /*#__PURE__*/Object.freeze({
231
+ __proto__: null,
232
+ sep: sep,
233
+ delimiter: delimiter,
234
+ normalize: normalize,
235
+ join: join,
236
+ resolve: resolve,
237
+ normalizeString: normalizeString,
238
+ isAbsolute: isAbsolute,
239
+ toNamespacedPath: toNamespacedPath,
240
+ extname: extname,
241
+ relative: relative,
242
+ dirname: dirname,
243
+ format: format,
244
+ basename: basename,
245
+ parse: parse
246
+ });
247
+
248
+ const index = {
249
+ ..._path
250
+ };
251
+
252
+ const isWindows = process.platform === "win32";
253
+ function toArray(array) {
254
+ array = array || [];
255
+ if (Array.isArray(array))
256
+ return array;
257
+ return [array];
258
+ }
259
+ function notNullish(v) {
260
+ return v != null;
261
+ }
262
+ function slash(str) {
263
+ return str.replace(/\\/g, "/");
264
+ }
265
+ function mergeSlashes(str) {
266
+ return str.replace(/\/\//g, "/");
267
+ }
268
+ const noop = () => {
269
+ };
270
+ function partitionSuiteChildren(suite) {
271
+ let tasksGroup = [];
272
+ const tasksGroups = [];
273
+ for (const c2 of suite.tasks) {
274
+ if (tasksGroup.length === 0 || c2.computeMode === tasksGroup[0].computeMode) {
275
+ tasksGroup.push(c2);
276
+ } else {
277
+ tasksGroups.push(tasksGroup);
278
+ tasksGroup = [c2];
279
+ }
280
+ }
281
+ if (tasksGroup.length > 0)
282
+ tasksGroups.push(tasksGroup);
283
+ return tasksGroups;
284
+ }
285
+ function interpretOnlyMode(tasks) {
286
+ if (tasks.some((t) => t.mode === "only")) {
287
+ tasks.forEach((t) => {
288
+ if (t.mode === "run")
289
+ t.mode = "skip";
290
+ else if (t.mode === "only")
291
+ t.mode = "run";
292
+ });
293
+ }
294
+ tasks.forEach((t) => {
295
+ if (t.type === "suite") {
296
+ if (t.mode === "skip")
297
+ t.tasks.forEach((c2) => c2.mode === "run" && (c2.mode = "skip"));
298
+ else
299
+ interpretOnlyMode(t.tasks);
300
+ }
301
+ });
302
+ }
303
+ function getTests(suite) {
304
+ return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c2) => c2.type === "test" ? [c2] : getTests(c2)));
305
+ }
306
+ function getTasks(tasks) {
307
+ return toArray(tasks).flatMap((s) => s.type === "test" ? [s] : [s, ...getTasks(s.tasks)]);
308
+ }
309
+ function getSuites(suite) {
310
+ return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
311
+ }
312
+ function hasTests(suite) {
313
+ return toArray(suite).some((s) => s.tasks.some((c2) => c2.type === "test" || hasTests(c2)));
314
+ }
315
+ function hasFailed(suite) {
316
+ return toArray(suite).some((s) => {
317
+ var _a;
318
+ return ((_a = s.result) == null ? void 0 : _a.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
319
+ });
320
+ }
321
+ function getNames(task) {
322
+ const names = [task.name];
323
+ let current = task;
324
+ while ((current == null ? void 0 : current.suite) || (current == null ? void 0 : current.file)) {
325
+ current = current.suite || current.file;
326
+ if (current == null ? void 0 : current.name)
327
+ names.unshift(current.name);
328
+ }
329
+ return names;
330
+ }
331
+ function getFullName(task) {
332
+ return getNames(task).join(c.dim(" > "));
333
+ }
334
+ async function ensurePackageInstalled(dependency, promptInstall = !process.env.CI && process.stdout.isTTY) {
335
+ if (isPackageExists(dependency))
336
+ return true;
337
+ console.log(c.red(`${c.inverse(c.red(" MISSING DEP "))} Can not find dependency '${dependency}'
338
+ `));
339
+ if (!promptInstall)
340
+ return false;
341
+ const prompts = await import('./index-fa899e66.js').then(function (n) { return n.i; });
342
+ const { install } = await prompts.prompt({
343
+ type: "confirm",
344
+ name: "install",
345
+ message: c.reset(`Do you want to install ${c.green(dependency)}?`)
346
+ });
347
+ if (install) {
348
+ await (await import('./index-9f4b9905.js')).installPackage(dependency, { dev: true });
349
+ return true;
350
+ }
351
+ return false;
352
+ }
353
+ function toFilePath(id, root) {
354
+ let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(dirname(root)) ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
355
+ if (absolute.startsWith("//"))
356
+ absolute = absolute.slice(1);
357
+ return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
358
+ }
359
+
360
+ export { getSuites as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getTests as f, getFullName as g, hasFailed as h, isAbsolute as i, resolve as j, toArray as k, join as l, notNullish as m, noop as n, mergeSlashes as o, index as p, getNames as q, relative as r, slash as s, toFilePath as t, interpretOnlyMode as u, partitionSuiteChildren as v, hasTests as w, isWindows as x, getTasks as y };
@@ -1,6 +1,6 @@
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-51946984.js';
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-67e478ef.js';
2
2
  import chai, { assert, should } from 'chai';
3
- import { s as spies, a as spyOn, f as fn } from './jest-mock-a57b745c.js';
3
+ import { s as spies, a as spyOn, f as fn } from './jest-mock-4a754991.js';
4
4
 
5
5
  const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
6
6
  const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Formatter } from 'picocolors/types';
2
2
  import { ViteDevServer } from 'vite';
3
+ import { RawSourceMap } from 'source-map-js';
3
4
  import { OptionsReceived } from 'pretty-format';
4
5
  import { MessagePort } from 'worker_threads';
5
- import { RawSourceMap } from 'source-map-js';
6
6
  export { Spy, SpyFn } from 'tinyspy';
7
7
  export { assert, default as chai, should } from 'chai';
8
8
 
@@ -196,6 +196,7 @@ declare class Vitest {
196
196
  pool: WorkerPool | undefined;
197
197
  invalidates: Set<string>;
198
198
  changedTests: Set<string>;
199
+ visitedFilesMap: Map<string, RawSourceMap>;
199
200
  runningPromise?: Promise<void>;
200
201
  isFirstRun: boolean;
201
202
  restartsCount: number;
@@ -214,6 +215,7 @@ declare class Vitest {
214
215
  close(): Promise<void>;
215
216
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
216
217
  globTestFiles(filters?: string[]): Promise<string[]>;
218
+ writeC8Sourcemap(): Promise<void>;
217
219
  isTargetFile(id: string): boolean;
218
220
  onServerRestarted(fn: () => void): void;
219
221
  }
@@ -550,6 +552,12 @@ interface InlineConfig {
550
552
  * @default ['**\/node_modules\/**', '**\/dist/**']
551
553
  */
552
554
  watchIgnore?: (string | RegExp)[];
555
+ /**
556
+ * Isolate environment for each test file
557
+ *
558
+ * @default true
559
+ */
560
+ isolate?: boolean;
553
561
  /**
554
562
  * Open Vitest UI
555
563
  * @internal WIP
@@ -618,23 +626,15 @@ interface WorkerContext {
618
626
  files: string[];
619
627
  invalidates?: string[];
620
628
  }
621
- interface RpcMap {
622
- fetch: [[id: string], string | undefined];
623
- getSourceMap: [[id: string, force?: boolean], RawSourceMap | undefined];
624
- log: [[UserConsoleLog], void];
625
- processExit: [[code?: number], void];
626
- onCollected: [[files: File[]], void];
627
- onFinished: [[], void];
628
- onTaskUpdate: [[pack: TaskResultPack], void];
629
- snapshotSaved: [[snapshot: SnapshotResult], void];
630
- }
631
- declare type RpcCall = <T extends keyof RpcMap>(method: T, ...args: RpcMap[T][0]) => Promise<RpcMap[T][1]>;
632
- declare type RpcSend = <T extends keyof RpcMap>(method: T, ...args: RpcMap[T][0]) => void;
633
- declare type RpcPayload<T extends keyof RpcMap = keyof RpcMap> = {
634
- id: string;
635
- method: T;
636
- args: RpcMap[T][0];
637
- };
629
+ interface WorkerRPC {
630
+ fetch: (id: string) => Promise<string | undefined>;
631
+ getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
632
+ log: (log: UserConsoleLog) => void;
633
+ processExit: (code?: number) => void;
634
+ onCollected: (files: File[]) => void;
635
+ onTaskUpdate: (pack: TaskResultPack) => void;
636
+ snapshotSaved: (snapshot: SnapshotResult) => void;
637
+ }
638
638
 
639
639
  declare const suite: ChainableFunction<"concurrent" | "skip" | "only" | "todo", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
640
640
  declare const test: TestCollector;
@@ -879,4 +879,4 @@ declare global {
879
879
  }
880
880
  }
881
881
 
882
- export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ComputeMode, ConstructorArgumentsOf, DoneCallback, 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, RpcCall, RpcMap, RpcPayload, RpcSend, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WorkerContext, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
882
+ export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ComputeMode, ConstructorArgumentsOf, DoneCallback, 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, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
- export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-51946984.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-09437c50.js';
3
- export { f as fn, s as spies, a as spyOn } from './jest-mock-a57b745c.js';
1
+ export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-67e478ef.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-ebf35a56.js';
3
+ export { f as fn, s as spies, a as spyOn } from './jest-mock-4a754991.js';
4
4
  export { assert, default as chai, should } from 'chai';
5
- import './index-041e627e.js';
5
+ import './index-ea5153a0.js';
6
+ import 'url';
6
7
  import 'tty';
7
8
  import 'local-pkg';
9
+ import 'path';
8
10
  import './_commonjsHelpers-c9e3b764.js';
9
11
  import 'tinyspy';
@@ -1,17 +1,6 @@
1
1
  import { util } from 'chai';
2
2
  import * as tinyspy from 'tinyspy';
3
3
 
4
- let urlAlphabet =
5
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
6
- let nanoid = (size = 21) => {
7
- let id = '';
8
- let i = size;
9
- while (i--) {
10
- id += urlAlphabet[(Math.random() * 64) | 0];
11
- }
12
- return id
13
- };
14
-
15
4
  const spies = /* @__PURE__ */ new Set();
16
5
  function spyOn(obj, method, accessType) {
17
6
  const dictionary = {
@@ -98,4 +87,4 @@ function fn(implementation) {
98
87
  }) }, "fn"));
99
88
  }
100
89
 
101
- export { spyOn as a, fn as f, nanoid as n, spies as s };
90
+ export { spyOn as a, fn as f, spies as s };
@@ -1,6 +1,8 @@
1
- import { A as API_PATH } from './constants-900abe4a.js';
1
+ import { A as API_PATH } from './constants-9c7f06df.js';
2
2
  import 'url';
3
- import './index-1488b423.js';
3
+ import './index-ea5153a0.js';
4
+ import 'tty';
5
+ import 'local-pkg';
4
6
  import 'path';
5
7
 
6
8
  /*! (c) 2020 Andrea Giammarchi */
package/dist/node.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ViteDevServer, UserConfig as UserConfig$1 } from 'vite';
2
+ import { RawSourceMap } from 'source-map-js';
2
3
  import { OptionsReceived } from 'pretty-format';
3
4
 
4
5
  declare abstract class BaseReporter implements Reporter {
@@ -266,6 +267,12 @@ interface InlineConfig {
266
267
  * @default ['**\/node_modules\/**', '**\/dist/**']
267
268
  */
268
269
  watchIgnore?: (string | RegExp)[];
270
+ /**
271
+ * Isolate environment for each test file
272
+ *
273
+ * @default true
274
+ */
275
+ isolate?: boolean;
269
276
  /**
270
277
  * Open Vitest UI
271
278
  * @internal WIP
@@ -363,6 +370,7 @@ declare class Vitest {
363
370
  pool: WorkerPool | undefined;
364
371
  invalidates: Set<string>;
365
372
  changedTests: Set<string>;
373
+ visitedFilesMap: Map<string, RawSourceMap>;
366
374
  runningPromise?: Promise<void>;
367
375
  isFirstRun: boolean;
368
376
  restartsCount: number;
@@ -381,6 +389,7 @@ declare class Vitest {
381
389
  close(): Promise<void>;
382
390
  report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
383
391
  globTestFiles(filters?: string[]): Promise<string[]>;
392
+ writeC8Sourcemap(): Promise<void>;
384
393
  isTargetFile(id: string): boolean;
385
394
  onServerRestarted(fn: () => void): void;
386
395
  }
package/dist/node.js CHANGED
@@ -1,23 +1,23 @@
1
- export { c as createVitest } from './index-c3f2f9fe.js';
2
- import './index-1488b423.js';
1
+ export { c as createVitest } from './index-36694964.js';
2
+ import 'fs';
3
+ import 'url';
4
+ import './index-ea5153a0.js';
5
+ import 'tty';
6
+ import 'local-pkg';
3
7
  import 'path';
4
8
  import 'vite';
5
9
  import 'process';
6
- import 'fs';
7
10
  import 'os';
8
11
  import 'util';
9
12
  import 'stream';
10
13
  import 'events';
11
- import './index-041e627e.js';
12
- import 'tty';
13
- import 'local-pkg';
14
- import './constants-900abe4a.js';
15
- import 'url';
14
+ import './constants-9c7f06df.js';
16
15
  import './magic-string.es-94000aea.js';
17
16
  import 'perf_hooks';
18
- import './diff-9c43ab50.js';
17
+ import './diff-3cfdad26.js';
19
18
  import './index-61c8686f.js';
20
19
  import './_commonjsHelpers-c9e3b764.js';
21
20
  import 'assert';
22
21
  import 'worker_threads';
23
22
  import 'tinypool';
23
+ import './index-7889832e.js';
@@ -1,10 +1,10 @@
1
- const rpc = async (method, ...args) => {
1
+ const rpc = (method, ...args) => {
2
2
  var _a;
3
- return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc(method, ...args);
3
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc.call(method, ...args);
4
4
  };
5
- const send = async (method, ...args) => {
5
+ const send = (method, ...args) => {
6
6
  var _a;
7
- return (_a = process.__vitest_worker__) == null ? void 0 : _a.send(method, ...args);
7
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc.send(method, ...args);
8
8
  };
9
9
 
10
10
  export { rpc as r, send as s };
package/dist/utils.js CHANGED
@@ -1,5 +1,5 @@
1
- export { e as ensurePackageInstalled, g as getFullName, f as getNames, a as getSuites, k as getTasks, b as getTests, h as hasFailed, j as hasTests, i as interpretOnlyMode, m as mergeSlashes, n as noop, d as notNullish, p as partitionSuiteChildren, s as slash, t as toArray } from './index-041e627e.js';
2
- export { a as resolvePath } from './index-1488b423.js';
1
+ export { e as ensurePackageInstalled, g as getFullName, q as getNames, a as getSuites, y as getTasks, f as getTests, h as hasFailed, w as hasTests, u as interpretOnlyMode, x as isWindows, o as mergeSlashes, n as noop, m as notNullish, v as partitionSuiteChildren, j as resolvePath, s as slash, k as toArray, t as toFilePath } from './index-ea5153a0.js';
2
+ import 'url';
3
3
  import 'tty';
4
4
  import 'local-pkg';
5
5
  import 'path';
@@ -1,6 +1,17 @@
1
- import { n as nanoid, a as spyOn, f as fn, s as spies } from './jest-mock-a57b745c.js';
2
- import { n as noop } from './index-041e627e.js';
1
+ import { n as noop } from './index-ea5153a0.js';
3
2
  import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
3
+ import { a as spyOn, f as fn, s as spies } from './jest-mock-4a754991.js';
4
+
5
+ let urlAlphabet =
6
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
7
+ let nanoid = (size = 21) => {
8
+ let id = '';
9
+ let i = size;
10
+ while (i--) {
11
+ id += urlAlphabet[(Math.random() * 64) | 0];
12
+ }
13
+ return id
14
+ };
4
15
 
5
16
  var __defProp = Object.defineProperty;
6
17
  var __defProps = Object.defineProperties;
@@ -1015,4 +1026,4 @@ class VitestUtils {
1015
1026
  const vitest = new VitestUtils();
1016
1027
  const vi = vitest;
1017
1028
 
1018
- export { JestChaiExpect as J, getDefaultHookTimeout as a, getState as b, suite as c, describe as d, vi as e, equals as f, getCurrentSuite as g, iterableEquality as h, it as i, subsetEquality as j, isA as k, clearContext as l, defaultSuite as m, setHooks as n, getHooks as o, context as p, getFn as q, setState as s, test as t, vitest as v, withTimeout as w };
1029
+ export { JestChaiExpect as J, getDefaultHookTimeout as a, getState as b, suite as c, describe as d, vi as e, equals as f, getCurrentSuite as g, iterableEquality as h, it as i, subsetEquality as j, isA as k, clearContext as l, defaultSuite as m, nanoid as n, setHooks as o, getHooks as p, context as q, getFn as r, setState as s, test as t, vitest as v, withTimeout as w };