vitest 0.27.1 → 0.27.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.
Files changed (31) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +9 -9
  3. package/dist/{chunk-api-setup.2be3cc38.js → chunk-api-setup.029198e3.js} +2 -2
  4. package/dist/{chunk-env-node.b3664da2.js → chunk-env-node.787e9561.js} +7 -0
  5. package/dist/{chunk-integrations-globals.02f1259c.js → chunk-integrations-globals.0024ce21.js} +5 -5
  6. package/dist/{chunk-mock-date.149ed990.js → chunk-mock-date.c543fa3e.js} +4 -1
  7. package/dist/{chunk-runtime-chain.4e2aa823.js → chunk-runtime-chain.2da9e75c.js} +3 -3
  8. package/dist/{chunk-runtime-error.97854396.js → chunk-runtime-error.de671af0.js} +1 -1
  9. package/dist/{chunk-runtime-mocker.4755840f.js → chunk-runtime-mocker.58511c38.js} +1 -1
  10. package/dist/{chunk-runtime-rpc.25cc9413.js → chunk-runtime-rpc.d709e91b.js} +1 -1
  11. package/dist/{chunk-runtime-setup.56d71d30.js → chunk-runtime-setup.35da9209.js} +14 -11
  12. package/dist/{chunk-snapshot-manager.1a2dbf96.js → chunk-snapshot-manager.ce714e21.js} +64 -24
  13. package/dist/{chunk-utils-import.16d9fb0d.js → chunk-utils-import.054ab315.js} +47 -4
  14. package/dist/{chunk-utils-source-map.4e9b891d.js → chunk-utils-source-map.5f5d12cf.js} +1 -1
  15. package/dist/cli.js +4 -4
  16. package/dist/config.cjs +1 -1
  17. package/dist/config.d.ts +1 -1
  18. package/dist/config.js +1 -1
  19. package/dist/entry.js +8 -8
  20. package/dist/environments.d.ts +1 -1
  21. package/dist/environments.js +1 -1
  22. package/dist/{index-1cfc7f58.d.ts → index-50755efe.d.ts} +1 -1
  23. package/dist/index.d.ts +8 -4
  24. package/dist/index.js +6 -6
  25. package/dist/loader.js +1 -1
  26. package/dist/node.d.ts +2 -2
  27. package/dist/node.js +5 -5
  28. package/dist/suite.js +4 -4
  29. package/dist/{types-5617096e.d.ts → types-d97c72c7.d.ts} +8 -2
  30. package/dist/worker.js +4 -4
  31. package/package.json +6 -6
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-1cfc7f58.js';
2
- import { b as ResolvedConfig } from './types-5617096e.js';
3
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ao as BaseCoverageOptions, au as BenchFunction, as as Benchmark, av as BenchmarkAPI, at as BenchmarkResult, ar as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, aq as CoverageC8Options, ap as CoverageIstanbulOptions, am as CoverageOptions, aj as CoverageProvider, ak as CoverageProviderModule, al as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, an as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-5617096e.js';
1
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-50755efe.js';
2
+ import { b as ResolvedConfig } from './types-d97c72c7.js';
3
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, aj as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, ak as ReportContext, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-d97c72c7.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
package/dist/browser.js CHANGED
@@ -1,12 +1,12 @@
1
- export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.4e2aa823.js';
2
- import { e as dist } from './chunk-utils-import.16d9fb0d.js';
3
- export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.16d9fb0d.js';
4
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.56d71d30.js';
1
+ export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.2da9e75c.js';
2
+ import { e as dist } from './chunk-utils-import.054ab315.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.054ab315.js';
4
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.35da9209.js';
5
5
  import * as chai from 'chai';
6
6
  export { chai };
7
7
  export { assert, should } from 'chai';
8
8
  import 'util';
9
- import './chunk-mock-date.149ed990.js';
9
+ import './chunk-mock-date.c543fa3e.js';
10
10
  import 'node:path';
11
11
  import 'picocolors';
12
12
  import 'local-pkg';
@@ -17,15 +17,15 @@ import './vendor-_commonjsHelpers.addc3445.js';
17
17
  import './chunk-utils-timers.52534f96.js';
18
18
  import './vendor-index.723a074f.js';
19
19
  import 'tinyspy';
20
- import './chunk-utils-source-map.4e9b891d.js';
21
- import './chunk-runtime-rpc.25cc9413.js';
20
+ import './chunk-utils-source-map.5f5d12cf.js';
21
+ import './chunk-runtime-rpc.d709e91b.js';
22
22
  import 'node:fs';
23
23
  import 'fs';
24
24
  import 'perf_hooks';
25
25
  import './chunk-integrations-coverage.44413252.js';
26
- import './chunk-runtime-error.97854396.js';
26
+ import './chunk-runtime-error.de671af0.js';
27
27
  import 'vite-node/source-map';
28
- import './chunk-env-node.b3664da2.js';
28
+ import './chunk-env-node.787e9561.js';
29
29
  import 'node:console';
30
30
 
31
31
 
@@ -11,8 +11,8 @@ import require$$1 from 'https';
11
11
  import require$$2$1 from 'http';
12
12
  import require$$7 from 'url';
13
13
  import { A as API_PATH } from './chunk-utils-env.f4a39d2c.js';
14
- import './chunk-mock-date.149ed990.js';
15
- import { b as parseStacktrace } from './chunk-utils-source-map.4e9b891d.js';
14
+ import './chunk-mock-date.c543fa3e.js';
15
+ import { b as parseStacktrace } from './chunk-utils-source-map.5f5d12cf.js';
16
16
  import 'node:url';
17
17
  import 'path';
18
18
  import 'node:path';
@@ -286,6 +286,13 @@ function populateGlobal(global, win, options = {}) {
286
286
  global.parent = global;
287
287
  if (global.global)
288
288
  global.global = global;
289
+ if (global.document && global.document.defaultView) {
290
+ Object.defineProperty(global.document, "defaultView", {
291
+ get: () => global,
292
+ enumerable: true,
293
+ configurable: true
294
+ });
295
+ }
289
296
  skipKeys.forEach((k) => keys.add(k));
290
297
  return {
291
298
  keys,
@@ -1,11 +1,11 @@
1
1
  import { m as globalApis } from './chunk-utils-env.f4a39d2c.js';
2
- import { i as index } from './chunk-utils-import.16d9fb0d.js';
2
+ import { i as index } from './chunk-utils-import.054ab315.js';
3
3
  import 'node:url';
4
4
  import 'path';
5
- import './chunk-runtime-chain.4e2aa823.js';
5
+ import './chunk-runtime-chain.2da9e75c.js';
6
6
  import 'util';
7
7
  import 'chai';
8
- import './chunk-mock-date.149ed990.js';
8
+ import './chunk-mock-date.c543fa3e.js';
9
9
  import 'node:path';
10
10
  import 'picocolors';
11
11
  import 'local-pkg';
@@ -13,8 +13,8 @@ import './vendor-_commonjsHelpers.addc3445.js';
13
13
  import './chunk-utils-timers.52534f96.js';
14
14
  import './vendor-index.723a074f.js';
15
15
  import 'tinyspy';
16
- import './chunk-utils-source-map.4e9b891d.js';
17
- import './chunk-runtime-rpc.25cc9413.js';
16
+ import './chunk-utils-source-map.5f5d12cf.js';
17
+ import './chunk-runtime-rpc.d709e91b.js';
18
18
  import 'node:fs';
19
19
  import 'fs';
20
20
 
@@ -181,6 +181,9 @@ function isAtomTest(s) {
181
181
  function getTests(suite) {
182
182
  return toArray(suite).flatMap((s) => isAtomTest(s) ? [s] : s.tasks.flatMap((c) => isAtomTest(c) ? [c] : getTests(c)));
183
183
  }
184
+ function getTasks(tasks = []) {
185
+ return toArray(tasks).flatMap((s) => isAtomTest(s) ? [s] : [s, ...getTasks(s.tasks)]);
186
+ }
184
187
  function getSuites(suite) {
185
188
  return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
186
189
  }
@@ -343,4 +346,4 @@ function objectAttr(source, path, defaultValue = void 0) {
343
346
  return result;
344
347
  }
345
348
 
346
- export { AggregateErrorPonyfill as A, hasFailedSnapshot as B, getSuites as C, deepMerge as D, removeUndefinedValues as E, isWindows as F, stdout as G, getAllMockableProperties as H, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, getCurrentEnvironment as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, relativePath as k, shuffle as l, mockDate as m, noop as n, objectAttr as o, partitionSuiteChildren as p, hasTests as q, resetDate as r, slash as s, toArray as t, hasFailed as u, createDefer as v, deepClone as w, getType as x, ensurePackageInstalled as y, getTests as z };
349
+ export { AggregateErrorPonyfill as A, getTests as B, hasFailedSnapshot as C, getSuites as D, deepMerge as E, removeUndefinedValues as F, isWindows as G, stdout as H, getAllMockableProperties as I, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, getCurrentEnvironment as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, relativePath as k, shuffle as l, mockDate as m, noop as n, objectAttr as o, partitionSuiteChildren as p, hasTests as q, resetDate as r, slash as s, toArray as t, hasFailed as u, createDefer as v, deepClone as w, getType as x, ensurePackageInstalled as y, getTasks as z };
@@ -1,13 +1,13 @@
1
1
  import util$1 from 'util';
2
2
  import * as chai$2 from 'chai';
3
3
  import { AssertionError, util, expect } from 'chai';
4
- import { i as isObject$1, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as getCurrentEnvironment, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.149ed990.js';
4
+ import { i as isObject$1, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as getCurrentEnvironment, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.c543fa3e.js';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
6
6
  import c from 'picocolors';
7
7
  import { c as createPatch, a as stringify, p as plugins_1, f as format_1, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.52534f96.js';
8
8
  import { i as isMockFunction } from './vendor-index.723a074f.js';
9
- import { c as cliTruncate, a as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, b as parseStacktrace } from './chunk-utils-source-map.4e9b891d.js';
10
- import { r as rpc } from './chunk-runtime-rpc.25cc9413.js';
9
+ import { c as cliTruncate, a as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, b as parseStacktrace } from './chunk-utils-source-map.5f5d12cf.js';
10
+ import { r as rpc } from './chunk-runtime-rpc.d709e91b.js';
11
11
  import fs from 'node:fs';
12
12
  import { j as join, d as dirname } from './chunk-utils-env.f4a39d2c.js';
13
13
  import { promises } from 'fs';
@@ -1,7 +1,7 @@
1
1
  import util$1 from 'util';
2
2
  import { util } from 'chai';
3
3
  import { a as stringify } from './chunk-utils-timers.52534f96.js';
4
- import { w as deepClone, g as getWorkerState, x as getType } from './chunk-mock-date.149ed990.js';
4
+ import { w as deepClone, g as getWorkerState, x as getType } from './chunk-mock-date.c543fa3e.js';
5
5
 
6
6
  const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
7
7
  const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
@@ -2,7 +2,7 @@ import { ViteNodeRunner } from 'vite-node/client';
2
2
  import { isInternalRequest } from 'vite-node/utils';
3
3
  import { normalizePath } from 'vite';
4
4
  import { i as isNodeBuiltin } from './vendor-index.b0346fe4.js';
5
- import { g as getWorkerState, x as getType, H as getAllMockableProperties, d as getCurrentEnvironment } from './chunk-mock-date.149ed990.js';
5
+ import { g as getWorkerState, x as getType, I as getAllMockableProperties, d as getCurrentEnvironment } from './chunk-mock-date.c543fa3e.js';
6
6
  import { existsSync, readdirSync } from 'node:fs';
7
7
  import { b as resolve, f as distDir, h as isAbsolute, d as dirname, j as join, c as basename, e as extname } from './chunk-utils-env.f4a39d2c.js';
8
8
  import c from 'picocolors';
@@ -1,4 +1,4 @@
1
- import { g as getWorkerState } from './chunk-mock-date.149ed990.js';
1
+ import { g as getWorkerState } from './chunk-mock-date.c543fa3e.js';
2
2
  import { s as safeSetTimeout } from './chunk-utils-timers.52534f96.js';
3
3
 
4
4
  const safeRandom = Math.random;
@@ -1,12 +1,12 @@
1
1
  import { performance } from 'perf_hooks';
2
2
  import { g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.44413252.js';
3
- import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.4e2aa823.js';
4
- import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.16d9fb0d.js';
5
- import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.149ed990.js';
6
- import { r as rpc } from './chunk-runtime-rpc.25cc9413.js';
7
- import { p as processError } from './chunk-runtime-error.97854396.js';
3
+ import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.2da9e75c.js';
4
+ import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.054ab315.js';
5
+ import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.c543fa3e.js';
6
+ import { r as rpc } from './chunk-runtime-rpc.d709e91b.js';
7
+ import { p as processError } from './chunk-runtime-error.de671af0.js';
8
8
  import { installSourcemapsSupport } from 'vite-node/source-map';
9
- import { e as environments } from './chunk-env-node.b3664da2.js';
9
+ import { e as environments } from './chunk-env-node.787e9561.js';
10
10
  import { i as isNode, a as isBrowser } from './chunk-utils-env.f4a39d2c.js';
11
11
  import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.52534f96.js';
12
12
 
@@ -20,6 +20,9 @@ async function setupGlobalEnv(config) {
20
20
  setupDefines(config.defines);
21
21
  if (globalSetup)
22
22
  return;
23
+ require.extensions[".css"] = () => ({});
24
+ require.extensions[".scss"] = () => ({});
25
+ require.extensions[".sass"] = () => ({});
23
26
  globalSetup = true;
24
27
  if (isNode) {
25
28
  const state = getWorkerState();
@@ -29,7 +32,7 @@ async function setupGlobalEnv(config) {
29
32
  await setupConsoleLogSpy();
30
33
  }
31
34
  if (config.globals)
32
- (await import('./chunk-integrations-globals.02f1259c.js')).registerApiGlobally();
35
+ (await import('./chunk-integrations-globals.0024ce21.js')).registerApiGlobally();
33
36
  }
34
37
  function setupDefines(defines) {
35
38
  for (const key in defines)
@@ -314,7 +317,7 @@ const callCleanupHooks = async (cleanups) => {
314
317
  async function runTest(test) {
315
318
  var _a, _b, _c;
316
319
  if (test.mode !== "run") {
317
- const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.4e2aa823.js').then(function (n) { return n.u; });
320
+ const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
318
321
  getSnapshotClient2().skipTestSnapshots(test);
319
322
  return;
320
323
  }
@@ -331,7 +334,7 @@ async function runTest(test) {
331
334
  clearModuleMocks();
332
335
  setCurrentTest(test);
333
336
  if (isNode) {
334
- const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.4e2aa823.js').then(function (n) { return n.u; });
337
+ const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
335
338
  await getSnapshotClient2().setTest(test);
336
339
  }
337
340
  const workerState = getWorkerState();
@@ -402,7 +405,7 @@ async function runTest(test) {
402
405
  console.error(test.result.error.message, test.result.error.stackStr);
403
406
  setCurrentTest(void 0);
404
407
  if (isNode) {
405
- const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.4e2aa823.js').then(function (n) { return n.u; });
408
+ const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
406
409
  getSnapshotClient2().clearTest();
407
410
  }
408
411
  test.result.duration = now() - start;
@@ -615,7 +618,7 @@ async function startTestsBrowser(paths, config) {
615
618
  async function startTestsNode(paths, config) {
616
619
  const files = await collectTests(paths, config);
617
620
  rpc().onCollected(files);
618
- const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.4e2aa823.js').then(function (n) { return n.u; });
621
+ const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
619
622
  getSnapshotClient2().clear();
620
623
  await runFiles(files, config);
621
624
  const coverage = await takeCoverageInsideWorker(config.coverage);
@@ -1,7 +1,7 @@
1
1
  import { j as join, c as basename, d as dirname, r as relative, e as extname, b as resolve, f as distDir, g as rootDir, h as isAbsolute, i as isNode, k as configFiles, l as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.f4a39d2c.js';
2
2
  import { p as pLimit, g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, a as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.44413252.js';
3
- import { g as getEnvPackageName } from './chunk-env-node.b3664da2.js';
4
- import { y as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, k as relativePath, z as getTests, e as getFullName, u as hasFailed, B as hasFailedSnapshot, C as getSuites, j as notNullish, l as shuffle, t as toArray, n as noop$1, D as deepMerge, b as getCallLastIndex, E as removeUndefinedValues, F as isWindows, G as stdout } from './chunk-mock-date.149ed990.js';
3
+ import { g as getEnvPackageName } from './chunk-env-node.787e9561.js';
4
+ import { y as ensurePackageInstalled, z as getTasks, A as AggregateErrorPonyfill, s as slash$1, k as relativePath, B as getTests, e as getFullName, u as hasFailed, C as hasFailedSnapshot, D as getSuites, j as notNullish, l as shuffle, t as toArray, n as noop$1, E as deepMerge, b as getCallLastIndex, F as removeUndefinedValues, G as isWindows, H as stdout } from './chunk-mock-date.c543fa3e.js';
5
5
  import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
6
6
  import path$a from 'node:path';
7
7
  import url, { fileURLToPath } from 'node:url';
@@ -28,7 +28,7 @@ import { cpus, hostname } from 'node:os';
28
28
  import { Tinypool } from 'tinypool';
29
29
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
30
30
  import { performance } from 'perf_hooks';
31
- import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.4e9b891d.js';
31
+ import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.5f5d12cf.js';
32
32
  import { g as safeSetInterval, h as safeClearInterval, s as safeSetTimeout, d as ansiStyles, c as createPatch, a as stringify$5, b as safeClearTimeout } from './chunk-utils-timers.52534f96.js';
33
33
  import { resolveModule } from 'local-pkg';
34
34
  import { createHash } from 'crypto';
@@ -41,7 +41,7 @@ import { stripLiteral } from 'strip-literal';
41
41
  import require$$0$3 from 'readline';
42
42
  import { p as prompts } from './vendor-index.9f20a9be.js';
43
43
 
44
- var version$1 = "0.27.1";
44
+ var version$1 = "0.27.2";
45
45
 
46
46
  class EndError extends Error {
47
47
  constructor(value) {
@@ -7126,6 +7126,27 @@ class Typechecker {
7126
7126
  this._tests = tests;
7127
7127
  return tests;
7128
7128
  }
7129
+ markPassed(file) {
7130
+ var _a;
7131
+ if (!((_a = file.result) == null ? void 0 : _a.state)) {
7132
+ file.result = {
7133
+ state: "pass"
7134
+ };
7135
+ }
7136
+ const markTasks = (tasks) => {
7137
+ var _a2;
7138
+ for (const task of tasks) {
7139
+ if ("tasks" in task)
7140
+ markTasks(task.tasks);
7141
+ if (!((_a2 = task.result) == null ? void 0 : _a2.state) && task.mode === "run") {
7142
+ task.result = {
7143
+ state: "pass"
7144
+ };
7145
+ }
7146
+ }
7147
+ };
7148
+ markTasks(file.tasks);
7149
+ }
7129
7150
  async prepareResults(output) {
7130
7151
  const typeErrors = await this.parseTscLikeOutput(output);
7131
7152
  const testFiles = new Set(this.getFiles());
@@ -7137,17 +7158,19 @@ class Typechecker {
7137
7158
  const { file, definitions, map, parsed } = this._tests[path];
7138
7159
  const errors = typeErrors.get(path);
7139
7160
  files.push(file);
7140
- if (!errors)
7161
+ if (!errors) {
7162
+ this.markPassed(file);
7141
7163
  return;
7164
+ }
7142
7165
  const sortedDefinitions = [...definitions.sort((a, b) => b.start - a.start)];
7143
7166
  const mapConsumer = map && new SourceMapConsumer(map);
7144
7167
  const indexMap = createIndexMap(parsed);
7145
- const markFailed = (task) => {
7168
+ const markState = (task, state) => {
7146
7169
  task.result = {
7147
- state: task.mode === "run" || task.mode === "only" ? "fail" : task.mode
7170
+ state: task.mode === "run" || task.mode === "only" ? state : task.mode
7148
7171
  };
7149
7172
  if (task.suite)
7150
- markFailed(task.suite);
7173
+ markState(task.suite, state);
7151
7174
  };
7152
7175
  errors.forEach(({ error, originalError }) => {
7153
7176
  var _a;
@@ -7167,8 +7190,9 @@ class Typechecker {
7167
7190
  };
7168
7191
  errors2.push(error);
7169
7192
  if (state === "fail" && suite.suite)
7170
- markFailed(suite.suite);
7193
+ markState(suite.suite, "fail");
7171
7194
  });
7195
+ this.markPassed(file);
7172
7196
  });
7173
7197
  typeErrors.forEach((errors, path) => {
7174
7198
  if (!testFiles.has(path))
@@ -7281,7 +7305,7 @@ class Typechecker {
7281
7305
  return Object.values(this._tests || {}).map((i) => i.file);
7282
7306
  }
7283
7307
  getTestPacks() {
7284
- return Object.values(this._tests || {}).map((i) => [i.file.id, void 0]);
7308
+ return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0]);
7285
7309
  }
7286
7310
  }
7287
7311
 
@@ -9165,7 +9189,7 @@ const config = {
9165
9189
  exclude: defaultExclude,
9166
9190
  testTimeout: 5e3,
9167
9191
  hookTimeout: 1e4,
9168
- teardownTimeout: 1e3,
9192
+ teardownTimeout: 1e4,
9169
9193
  isolate: true,
9170
9194
  watchExclude: ["**/node_modules/**", "**/dist/**"],
9171
9195
  forceRerunTriggers: [
@@ -9470,6 +9494,10 @@ function resolveConfig(mode, options, viteConfig) {
9470
9494
  resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
9471
9495
  )
9472
9496
  );
9497
+ resolved.forceRerunTriggers = [
9498
+ ...resolved.forceRerunTriggers,
9499
+ ...resolved.setupFiles
9500
+ ];
9473
9501
  resolved.api = resolveApiConfig(options);
9474
9502
  if (options.related)
9475
9503
  resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
@@ -9991,7 +10019,7 @@ createLogUpdate(process$1.stdout);
9991
10019
 
9992
10020
  createLogUpdate(process$1.stderr);
9993
10021
 
9994
- var version = "0.27.1";
10022
+ var version = "0.27.2";
9995
10023
 
9996
10024
  function formatLine(line, outputTruncateLength) {
9997
10025
  var _a;
@@ -10122,10 +10150,10 @@ async function printError(error, ctx, options = {}) {
10122
10150
  }
10123
10151
  const testPath = e.VITEST_TEST_PATH;
10124
10152
  const testName = e.VITEST_TEST_NAME;
10125
- if (testPath && !testName)
10153
+ if (testPath)
10126
10154
  ctx.logger.error(c.red(`This error originated in "${c.bold(testPath)}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`));
10127
10155
  if (testName) {
10128
- ctx.logger.error(c.red(`The latest test that migh've cause the error is "${c.bold(testName)}". It might mean one of the following:
10156
+ ctx.logger.error(c.red(`The latest test that might've caused the error is "${c.bold(testName)}". It might mean one of the following:
10129
10157
  - The error was thrown, while Vitest was running this test.
10130
10158
  - This was the last recorder test before the error was thrown, if error originated after test finished its execution.`));
10131
10159
  }
@@ -10559,10 +10587,7 @@ class Vitest {
10559
10587
  }
10560
10588
  await Promise.all(files.map((file) => this.cache.stats.updateStats(file)));
10561
10589
  await this.runFiles(files);
10562
- if (this.coverageProvider) {
10563
- this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
10564
- await this.coverageProvider.reportCoverage();
10565
- }
10590
+ await this.reportCoverage(true);
10566
10591
  if (this.config.watch && !this.config.browser)
10567
10592
  await this.report("onWatcherStart");
10568
10593
  }
@@ -10649,8 +10674,11 @@ class Vitest {
10649
10674
  return await this.runningPromise;
10650
10675
  }
10651
10676
  async rerunFiles(files = this.state.getFilepaths(), trigger) {
10677
+ if (this.coverageProvider && this.config.coverage.cleanOnRerun)
10678
+ await this.coverageProvider.clean();
10652
10679
  await this.report("onWatcherRerun", files, trigger);
10653
10680
  await this.runFiles(files);
10681
+ await this.reportCoverage(!trigger);
10654
10682
  if (!this.config.browser)
10655
10683
  await this.report("onWatcherStart");
10656
10684
  }
@@ -10692,7 +10720,6 @@ class Vitest {
10692
10720
  if (this.restartsCount !== currentCount)
10693
10721
  return;
10694
10722
  this._rerunTimer = safeSetTimeout(async () => {
10695
- var _a;
10696
10723
  if (this.changedTests.size === 0) {
10697
10724
  this.invalidates.clear();
10698
10725
  return;
@@ -10707,7 +10734,7 @@ class Vitest {
10707
10734
  await this.coverageProvider.clean();
10708
10735
  await this.report("onWatcherRerun", files, triggerId);
10709
10736
  await this.runFiles(files);
10710
- await ((_a = this.coverageProvider) == null ? void 0 : _a.reportCoverage());
10737
+ await this.reportCoverage(false);
10711
10738
  if (!this.config.browser)
10712
10739
  await this.report("onWatcherStart");
10713
10740
  }, WATCHER_DEBOUNCE);
@@ -10784,6 +10811,12 @@ class Vitest {
10784
10811
  });
10785
10812
  return rerun;
10786
10813
  }
10814
+ async reportCoverage(allTestsRun) {
10815
+ if (this.coverageProvider) {
10816
+ this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
10817
+ await this.coverageProvider.reportCoverage({ allTestsRun });
10818
+ }
10819
+ }
10787
10820
  async close() {
10788
10821
  var _a, _b;
10789
10822
  if (!this.closingPromise) {
@@ -11285,12 +11318,19 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11285
11318
  (_c = process.env).SSR ?? (_c.SSR = "1");
11286
11319
  for (const name in envs)
11287
11320
  (_d = process.env)[name] ?? (_d[name] = envs[name]);
11321
+ if (!options.watch) {
11322
+ viteConfig.server.watch = {
11323
+ persistent: false,
11324
+ depth: 0,
11325
+ ignored: ["**/*"]
11326
+ };
11327
+ }
11288
11328
  },
11289
11329
  async configureServer(server) {
11290
11330
  try {
11291
11331
  await ctx.setServer(options, server);
11292
11332
  if (options.api && options.watch)
11293
- (await import('./chunk-api-setup.2be3cc38.js')).setup(ctx);
11333
+ (await import('./chunk-api-setup.029198e3.js')).setup(ctx);
11294
11334
  } catch (err) {
11295
11335
  ctx.logger.printError(err, true);
11296
11336
  process.exit(1);
@@ -11386,7 +11426,7 @@ function registerConsoleShortcuts(ctx) {
11386
11426
  message: "Input test name pattern (RegExp)",
11387
11427
  initial: ((_a = ctx.config.testNamePattern) == null ? void 0 : _a.source) || ""
11388
11428
  }]);
11389
- await ctx.changeNamePattern(filter, void 0, "change pattern");
11429
+ await ctx.changeNamePattern(filter.trim(), void 0, "change pattern");
11390
11430
  on();
11391
11431
  }
11392
11432
  async function inputFilePattern() {
@@ -11397,8 +11437,8 @@ function registerConsoleShortcuts(ctx) {
11397
11437
  message: "Input filename pattern",
11398
11438
  initial: latestFilename
11399
11439
  }]);
11400
- latestFilename = filter;
11401
- await ctx.changeFilenamePattern(filter);
11440
+ latestFilename = filter.trim();
11441
+ await ctx.changeFilenamePattern(filter.trim());
11402
11442
  on();
11403
11443
  }
11404
11444
  let rl;
@@ -1,6 +1,6 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.4e2aa823.js';
2
- import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.149ed990.js';
3
- import { p as parseSingleStack } from './chunk-utils-source-map.4e9b891d.js';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.2da9e75c.js';
2
+ import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.c543fa3e.js';
3
+ import { p as parseSingleStack } from './chunk-utils-source-map.5f5d12cf.js';
4
4
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
5
5
  import util from 'util';
6
6
  import { s as spyOn, f as fn, i as isMockFunction, a as spies } from './vendor-index.723a074f.js';
@@ -2665,10 +2665,18 @@ class FakeTimers {
2665
2665
  if (this._checkFakeTimers())
2666
2666
  this._clock.runAll();
2667
2667
  }
2668
+ async runAllTimersAsync() {
2669
+ if (this._checkFakeTimers())
2670
+ await this._clock.runAllAsync();
2671
+ }
2668
2672
  runOnlyPendingTimers() {
2669
2673
  if (this._checkFakeTimers())
2670
2674
  this._clock.runToLast();
2671
2675
  }
2676
+ async runOnlyPendingTimersAsync() {
2677
+ if (this._checkFakeTimers())
2678
+ await this._clock.runToLastAsync();
2679
+ }
2672
2680
  advanceTimersToNextTimer(steps = 1) {
2673
2681
  if (this._checkFakeTimers()) {
2674
2682
  for (let i = steps; i > 0; i--) {
@@ -2679,10 +2687,24 @@ class FakeTimers {
2679
2687
  }
2680
2688
  }
2681
2689
  }
2690
+ async advanceTimersToNextTimerAsync(steps = 1) {
2691
+ if (this._checkFakeTimers()) {
2692
+ for (let i = steps; i > 0; i--) {
2693
+ await this._clock.nextAsync();
2694
+ this._clock.tick(0);
2695
+ if (this._clock.countTimers() === 0)
2696
+ break;
2697
+ }
2698
+ }
2699
+ }
2682
2700
  advanceTimersByTime(msToRun) {
2683
2701
  if (this._checkFakeTimers())
2684
2702
  this._clock.tick(msToRun);
2685
2703
  }
2704
+ async advanceTimersByTimeAsync(msToRun) {
2705
+ if (this._checkFakeTimers())
2706
+ await this._clock.tickAsync(msToRun);
2707
+ }
2686
2708
  runAllTicks() {
2687
2709
  if (this._checkFakeTimers()) {
2688
2710
  this._clock.runMicrotasks();
@@ -2788,10 +2810,18 @@ class VitestUtils {
2788
2810
  this._timers.runOnlyPendingTimers();
2789
2811
  return this;
2790
2812
  }
2813
+ async runOnlyPendingTimersAsync() {
2814
+ await this._timers.runOnlyPendingTimersAsync();
2815
+ return this;
2816
+ }
2791
2817
  runAllTimers() {
2792
2818
  this._timers.runAllTimers();
2793
2819
  return this;
2794
2820
  }
2821
+ async runAllTimersAsync() {
2822
+ await this._timers.runAllTimersAsync();
2823
+ return this;
2824
+ }
2795
2825
  runAllTicks() {
2796
2826
  this._timers.runAllTicks();
2797
2827
  return this;
@@ -2800,10 +2830,18 @@ class VitestUtils {
2800
2830
  this._timers.advanceTimersByTime(ms);
2801
2831
  return this;
2802
2832
  }
2833
+ async advanceTimersByTimeAsync(ms) {
2834
+ await this._timers.advanceTimersByTimeAsync(ms);
2835
+ return this;
2836
+ }
2803
2837
  advanceTimersToNextTimer() {
2804
2838
  this._timers.advanceTimersToNextTimer();
2805
2839
  return this;
2806
2840
  }
2841
+ async advanceTimersToNextTimerAsync() {
2842
+ await this._timers.advanceTimersToNextTimerAsync();
2843
+ return this;
2844
+ }
2807
2845
  getTimerCount() {
2808
2846
  return this._timers.getTimerCount();
2809
2847
  }
@@ -2873,7 +2911,12 @@ class VitestUtils {
2873
2911
  stubGlobal(name, value) {
2874
2912
  if (!this._stubsGlobal.has(name))
2875
2913
  this._stubsGlobal.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
2876
- globalThis[name] = value;
2914
+ Object.defineProperty(globalThis, name, {
2915
+ value,
2916
+ writable: true,
2917
+ configurable: true,
2918
+ enumerable: true
2919
+ });
2877
2920
  return this;
2878
2921
  }
2879
2922
  stubEnv(name, value) {
@@ -1,6 +1,6 @@
1
1
  import { d as ansiStyles, e as eastAsianWidth } from './chunk-utils-timers.52534f96.js';
2
2
  import { b as resolve } from './chunk-utils-env.f4a39d2c.js';
3
- import { j as notNullish } from './chunk-mock-date.149ed990.js';
3
+ import { j as notNullish } from './chunk-mock-date.c543fa3e.js';
4
4
 
5
5
  /* eslint-disable yoda */
6
6
 
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { n as normalize } from './chunk-utils-env.f4a39d2c.js';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.1a2dbf96.js';
4
+ import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.ce714e21.js';
5
5
  import 'node:url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.44413252.js';
8
8
  import 'local-pkg';
9
- import './chunk-env-node.b3664da2.js';
9
+ import './chunk-env-node.787e9561.js';
10
10
  import 'node:console';
11
- import './chunk-mock-date.149ed990.js';
11
+ import './chunk-mock-date.c543fa3e.js';
12
12
  import 'node:path';
13
13
  import 'vite';
14
14
  import 'node:process';
@@ -38,7 +38,7 @@ import 'node:worker_threads';
38
38
  import 'tinypool';
39
39
  import './vendor-index.783e7f3e.js';
40
40
  import 'perf_hooks';
41
- import './chunk-utils-source-map.4e9b891d.js';
41
+ import './chunk-utils-source-map.5f5d12cf.js';
42
42
  import './chunk-utils-timers.52534f96.js';
43
43
  import 'crypto';
44
44
  import 'vite-node/utils';
package/dist/config.cjs CHANGED
@@ -57,7 +57,7 @@ const config = {
57
57
  exclude: defaultExclude,
58
58
  testTimeout: 5e3,
59
59
  hookTimeout: 1e4,
60
- teardownTimeout: 1e3,
60
+ teardownTimeout: 1e4,
61
61
  isolate: true,
62
62
  watchExclude: ["**/node_modules/**", "**/dist/**"],
63
63
  forceRerunTriggers: [
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { U as UserConfig$1, an as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-5617096e.js';
3
+ import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-d97c72c7.js';
4
4
  import 'tinybench';
5
5
  import 'vite-node/client';
6
6
  import 'vite-node/server';
package/dist/config.js CHANGED
@@ -53,7 +53,7 @@ const config = {
53
53
  exclude: defaultExclude,
54
54
  testTimeout: 5e3,
55
55
  hookTimeout: 1e4,
56
- teardownTimeout: 1e3,
56
+ teardownTimeout: 1e4,
57
57
  isolate: true,
58
58
  watchExclude: ["**/node_modules/**", "**/dist/**"],
59
59
  forceRerunTriggers: [
package/dist/entry.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import { promises } from 'node:fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-mock-date.149ed990.js';
3
- import { v as vi } from './chunk-utils-import.16d9fb0d.js';
4
- import { a as envs } from './chunk-env-node.b3664da2.js';
5
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.56d71d30.js';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-mock-date.c543fa3e.js';
3
+ import { v as vi } from './chunk-utils-import.054ab315.js';
4
+ import { a as envs } from './chunk-env-node.787e9561.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.35da9209.js';
6
6
  import 'node:path';
7
7
  import 'picocolors';
8
8
  import 'local-pkg';
9
9
  import './chunk-utils-env.f4a39d2c.js';
10
10
  import 'node:url';
11
11
  import 'path';
12
- import './chunk-runtime-chain.4e2aa823.js';
12
+ import './chunk-runtime-chain.2da9e75c.js';
13
13
  import 'util';
14
14
  import 'chai';
15
15
  import './vendor-_commonjsHelpers.addc3445.js';
16
16
  import './chunk-utils-timers.52534f96.js';
17
17
  import './vendor-index.723a074f.js';
18
18
  import 'tinyspy';
19
- import './chunk-utils-source-map.4e9b891d.js';
20
- import './chunk-runtime-rpc.25cc9413.js';
19
+ import './chunk-utils-source-map.5f5d12cf.js';
20
+ import './chunk-runtime-rpc.d709e91b.js';
21
21
  import 'fs';
22
22
  import 'node:console';
23
23
  import 'perf_hooks';
24
24
  import './chunk-integrations-coverage.44413252.js';
25
- import './chunk-runtime-error.97854396.js';
25
+ import './chunk-runtime-error.de671af0.js';
26
26
  import 'vite-node/source-map';
27
27
 
28
28
  function groupBy(collection, iteratee) {
@@ -1,4 +1,4 @@
1
- import { ae as Environment } from './types-5617096e.js';
1
+ import { ae as Environment } from './types-d97c72c7.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
4
  import 'vite-node/client';
@@ -1,3 +1,3 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.b3664da2.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.787e9561.js';
2
2
  import 'node:console';
3
3
  import 'local-pkg';
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { w as SuiteAPI, v as TestAPI, av as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, q as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, r as Test } from './types-5617096e.js';
2
+ import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, q as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, r as Test } from './types-d97c72c7.js';
3
3
 
4
4
  declare type Not<T extends boolean> = T extends true ? false : true;
5
5
  declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-1cfc7f58.js';
2
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-1cfc7f58.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, c as ModuleGraphData, d as Reporter } from './types-5617096e.js';
4
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ao as BaseCoverageOptions, au as BenchFunction, as as Benchmark, av as BenchmarkAPI, at as BenchmarkResult, ar as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, aq as CoverageC8Options, ap as CoverageIstanbulOptions, am as CoverageOptions, aj as CoverageProvider, ak as CoverageProviderModule, al as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, an as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-5617096e.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-50755efe.js';
2
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-50755efe.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, c as ModuleGraphData, d as Reporter } from './types-d97c72c7.js';
4
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, aj as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, ak as ReportContext, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-d97c72c7.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
@@ -46,10 +46,14 @@ declare class VitestUtils {
46
46
  useFakeTimers(config?: FakeTimerInstallOpts): this;
47
47
  useRealTimers(): this;
48
48
  runOnlyPendingTimers(): this;
49
+ runOnlyPendingTimersAsync(): Promise<this>;
49
50
  runAllTimers(): this;
51
+ runAllTimersAsync(): Promise<this>;
50
52
  runAllTicks(): this;
51
53
  advanceTimersByTime(ms: number): this;
54
+ advanceTimersByTimeAsync(ms: number): Promise<this>;
52
55
  advanceTimersToNextTimer(): this;
56
+ advanceTimersToNextTimerAsync(): Promise<this>;
53
57
  getTimerCount(): number;
54
58
  setSystemTime(time: number | string | Date): this;
55
59
  getMockedSystemTime(): string | number | Date | null;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.4e2aa823.js';
2
- import { e as dist } from './chunk-utils-import.16d9fb0d.js';
3
- export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.16d9fb0d.js';
1
+ export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.2da9e75c.js';
2
+ import { e as dist } from './chunk-utils-import.054ab315.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.054ab315.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  import 'util';
8
- import './chunk-mock-date.149ed990.js';
8
+ import './chunk-mock-date.c543fa3e.js';
9
9
  import 'node:path';
10
10
  import 'picocolors';
11
11
  import 'local-pkg';
@@ -16,8 +16,8 @@ import './vendor-_commonjsHelpers.addc3445.js';
16
16
  import './chunk-utils-timers.52534f96.js';
17
17
  import './vendor-index.723a074f.js';
18
18
  import 'tinyspy';
19
- import './chunk-utils-source-map.4e9b891d.js';
20
- import './chunk-runtime-rpc.25cc9413.js';
19
+ import './chunk-utils-source-map.5f5d12cf.js';
20
+ import './chunk-runtime-rpc.d709e91b.js';
21
21
  import 'node:fs';
22
22
  import 'fs';
23
23
 
package/dist/loader.js CHANGED
@@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.b0346fe4.js';
4
4
  import { normalizeModuleId } from 'vite-node/utils';
5
- import { g as getWorkerState } from './chunk-mock-date.149ed990.js';
5
+ import { g as getWorkerState } from './chunk-mock-date.c543fa3e.js';
6
6
  import 'acorn';
7
7
  import 'node:module';
8
8
  import 'node:fs';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { k as VitestRunMode, U as UserConfig, N as Vitest, aw as MockFactory, ax as MockMap, ay as TestSequencer } from './types-5617096e.js';
2
- export { ay as TestSequencer, aA as TestSequencerConstructor, N as Vitest, az as startVitest } from './types-5617096e.js';
1
+ import { k as VitestRunMode, U as UserConfig, N as Vitest, ax as MockFactory, ay as MockMap, az as TestSequencer } from './types-d97c72c7.js';
2
+ export { az as TestSequencer, aB as TestSequencerConstructor, N as Vitest, aA as startVitest } from './types-d97c72c7.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import { ViteNodeRunner } from 'vite-node/client';
5
5
  import { ViteNodeRunnerOptions } from 'vite-node';
package/dist/node.js CHANGED
@@ -1,13 +1,13 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.1a2dbf96.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.4755840f.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.ce714e21.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.58511c38.js';
3
3
  import './chunk-utils-env.f4a39d2c.js';
4
4
  import 'node:url';
5
5
  import 'path';
6
6
  import './chunk-integrations-coverage.44413252.js';
7
7
  import 'local-pkg';
8
- import './chunk-env-node.b3664da2.js';
8
+ import './chunk-env-node.787e9561.js';
9
9
  import 'node:console';
10
- import './chunk-mock-date.149ed990.js';
10
+ import './chunk-mock-date.c543fa3e.js';
11
11
  import 'node:path';
12
12
  import 'picocolors';
13
13
  import 'vite';
@@ -38,7 +38,7 @@ import 'node:worker_threads';
38
38
  import 'tinypool';
39
39
  import './vendor-index.783e7f3e.js';
40
40
  import 'perf_hooks';
41
- import './chunk-utils-source-map.4e9b891d.js';
41
+ import './chunk-utils-source-map.5f5d12cf.js';
42
42
  import './chunk-utils-timers.52534f96.js';
43
43
  import 'crypto';
44
44
  import 'vite-node/utils';
package/dist/suite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'util';
2
2
  import 'chai';
3
- import './chunk-mock-date.149ed990.js';
4
- export { b as bench, f as clearCollectorContext, r as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.4e2aa823.js';
3
+ import './chunk-mock-date.c543fa3e.js';
4
+ export { b as bench, f as clearCollectorContext, r as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.2da9e75c.js';
5
5
  import 'node:path';
6
6
  import 'picocolors';
7
7
  import 'local-pkg';
@@ -12,7 +12,7 @@ import './vendor-_commonjsHelpers.addc3445.js';
12
12
  import './chunk-utils-timers.52534f96.js';
13
13
  import './vendor-index.723a074f.js';
14
14
  import 'tinyspy';
15
- import './chunk-utils-source-map.4e9b891d.js';
16
- import './chunk-runtime-rpc.25cc9413.js';
15
+ import './chunk-utils-source-map.5f5d12cf.js';
16
+ import './chunk-runtime-rpc.d709e91b.js';
17
17
  import 'node:fs';
18
18
  import 'fs';
@@ -226,6 +226,7 @@ declare class Typechecker {
226
226
  protected collectFileTests(filepath: string): Promise<FileInformation | null>;
227
227
  protected getFiles(): string[];
228
228
  collectTests(): Promise<Record<string, FileInformation>>;
229
+ protected markPassed(file: File): void;
229
230
  protected prepareResults(output: string): Promise<{
230
231
  files: File[];
231
232
  sourceErrors: TypeCheckError[];
@@ -404,6 +405,7 @@ declare class Vitest {
404
405
  * @returns A value indicating whether rerun is needed (changedTests was mutated)
405
406
  */
406
407
  private handleFileChanged;
408
+ private reportCoverage;
407
409
  close(): Promise<void>;
408
410
  /**
409
411
  * Close the thread pool and exit the process
@@ -1201,9 +1203,13 @@ interface CoverageProvider {
1201
1203
  clean(clean?: boolean): void | Promise<void>;
1202
1204
  onBeforeFilesRun?(): void | Promise<void>;
1203
1205
  onAfterSuiteRun(meta: AfterSuiteRunMeta): void | Promise<void>;
1204
- reportCoverage(): void | Promise<void>;
1206
+ reportCoverage(reportContext: ReportContext): void | Promise<void>;
1205
1207
  onFileTransform?(sourceCode: string, id: string, pluginCtx: TransformPluginContext): TransformResult | Promise<TransformResult>;
1206
1208
  }
1209
+ interface ReportContext {
1210
+ /** Indicates whether all tests were run. False when only specific tests were run. */
1211
+ allTestsRun?: boolean;
1212
+ }
1207
1213
  interface CoverageProviderModule {
1208
1214
  /**
1209
1215
  * Factory for creating a new coverage provider
@@ -2265,4 +2271,4 @@ type Context = RootAndTarget & {
2265
2271
  lastActivePath?: string;
2266
2272
  };
2267
2273
 
2268
- export { WorkerContext as $, ApiConfig as A, BuiltinEnvironment as B, CollectLineNumbers as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, SuiteFactory as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, RuntimeContext as K, TestContext as L, MockFactoryWithHelper as M, Vitest as N, OnTestFailedHandler as O, SnapshotData as P, SnapshotUpdateState as Q, RuntimeConfig as R, SequenceHooks as S, TaskResultPack as T, UserConfig as U, VitestEnvironment as V, SnapshotStateOptions as W, SnapshotMatchOptions as X, SnapshotResult as Y, UncheckedSnapshot as Z, SnapshotSummary as _, File as a, ResolveIdFunction as a0, AfterSuiteRunMeta as a1, WorkerRPC as a2, WorkerGlobalState as a3, Awaitable as a4, Nullable as a5, Arrayable as a6, ArgumentsType$1 as a7, MergeInsertions as a8, DeepMerge as a9, TestSequencerConstructor as aA, MutableArray as aa, Constructable as ab, ModuleCache as ac, EnvironmentReturn as ad, Environment as ae, UserConsoleLog as af, ParsedStack as ag, ErrorWithDiff as ah, OnServerRestartHandler as ai, CoverageProvider as aj, CoverageProviderModule as ak, CoverageReporter as al, CoverageOptions as am, ResolvedCoverageOptions as an, BaseCoverageOptions as ao, CoverageIstanbulOptions as ap, CoverageC8Options as aq, BenchmarkUserOptions as ar, Benchmark as as, BenchmarkResult as at, BenchFunction as au, BenchmarkAPI as av, MockFactory as aw, MockMap as ax, TestSequencer as ay, startVitest as az, ResolvedConfig as b, ModuleGraphData as c, Reporter as d, RawErrsMap as e, TscErrorInfo as f, CollectLines as g, RootAndTarget as h, Context as i, CSSModuleScopeStrategy as j, VitestRunMode as k, TypecheckConfig as l, RunMode as m, TaskState as n, TaskBase as o, TaskResult as p, Suite as q, Test as r, Task as s, TestFunction as t, TestOptions as u, TestAPI as v, SuiteAPI as w, HookCleanupCallback as x, SuiteHooks as y, SuiteCollector as z };
2274
+ export { WorkerContext as $, ApiConfig as A, BuiltinEnvironment as B, CollectLineNumbers as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, SuiteFactory as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, RuntimeContext as K, TestContext as L, MockFactoryWithHelper as M, Vitest as N, OnTestFailedHandler as O, SnapshotData as P, SnapshotUpdateState as Q, RuntimeConfig as R, SequenceHooks as S, TaskResultPack as T, UserConfig as U, VitestEnvironment as V, SnapshotStateOptions as W, SnapshotMatchOptions as X, SnapshotResult as Y, UncheckedSnapshot as Z, SnapshotSummary as _, File as a, ResolveIdFunction as a0, AfterSuiteRunMeta as a1, WorkerRPC as a2, WorkerGlobalState as a3, Awaitable as a4, Nullable as a5, Arrayable as a6, ArgumentsType$1 as a7, MergeInsertions as a8, DeepMerge as a9, startVitest as aA, TestSequencerConstructor as aB, MutableArray as aa, Constructable as ab, ModuleCache as ac, EnvironmentReturn as ad, Environment as ae, UserConsoleLog as af, ParsedStack as ag, ErrorWithDiff as ah, OnServerRestartHandler as ai, CoverageProvider as aj, ReportContext as ak, CoverageProviderModule as al, CoverageReporter as am, CoverageOptions as an, ResolvedCoverageOptions as ao, BaseCoverageOptions as ap, CoverageIstanbulOptions as aq, CoverageC8Options as ar, BenchmarkUserOptions as as, Benchmark as at, BenchmarkResult as au, BenchFunction as av, BenchmarkAPI as aw, MockFactory as ax, MockMap as ay, TestSequencer as az, ResolvedConfig as b, ModuleGraphData as c, Reporter as d, RawErrsMap as e, TscErrorInfo as f, CollectLines as g, RootAndTarget as h, Context as i, CSSModuleScopeStrategy as j, VitestRunMode as k, TypecheckConfig as l, RunMode as m, TaskState as n, TaskBase as o, TaskResult as p, Suite as q, Test as r, Task as s, TestFunction as t, TestOptions as u, TestAPI as v, SuiteAPI as w, HookCleanupCallback as x, SuiteHooks as y, SuiteCollector as z };
package/dist/worker.js CHANGED
@@ -3,10 +3,10 @@ import { c as createBirpc } from './vendor-index.783e7f3e.js';
3
3
  import { workerId } from 'tinypool';
4
4
  import { ModuleCacheMap } from 'vite-node/client';
5
5
  import { isPrimitive } from 'vite-node/utils';
6
- import { g as getWorkerState } from './chunk-mock-date.149ed990.js';
7
- import { e as executeInViteNode } from './chunk-runtime-mocker.4755840f.js';
8
- import { r as rpc } from './chunk-runtime-rpc.25cc9413.js';
9
- import { p as processError } from './chunk-runtime-error.97854396.js';
6
+ import { g as getWorkerState } from './chunk-mock-date.c543fa3e.js';
7
+ import { e as executeInViteNode } from './chunk-runtime-mocker.58511c38.js';
8
+ import { r as rpc } from './chunk-runtime-rpc.d709e91b.js';
9
+ import { p as processError } from './chunk-runtime-error.de671af0.js';
10
10
  import 'node:url';
11
11
  import 'path';
12
12
  import 'node:path';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.27.1",
4
+ "version": "0.27.2",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -118,7 +118,7 @@
118
118
  "tinyspy": "^1.0.2",
119
119
  "vite": "^3.0.0 || ^4.0.0",
120
120
  "why-is-node-running": "^2.2.2",
121
- "vite-node": "0.27.1"
121
+ "vite-node": "0.27.2"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@antfu/install-pkg": "^0.1.1",
@@ -157,10 +157,10 @@
157
157
  "strip-ansi": "^7.0.1",
158
158
  "typescript": "^4.9.4",
159
159
  "ws": "^8.12.0",
160
- "@vitest/expect": "0.27.1",
161
- "@vitest/ui": "0.27.1",
162
- "@vitest/utils": "0.27.1",
163
- "@vitest/spy": "0.27.1"
160
+ "@vitest/expect": "0.27.2",
161
+ "@vitest/spy": "0.27.2",
162
+ "@vitest/utils": "0.27.2",
163
+ "@vitest/ui": "0.27.2"
164
164
  },
165
165
  "scripts": {
166
166
  "build": "rimraf dist && rollup -c",