vitest 0.25.0 → 0.25.1

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 (40) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +11 -11
  3. package/dist/{chunk-api-setup.a13c5f9d.js → chunk-api-setup.f40616e2.js} +3 -3
  4. package/dist/{chunk-env-node.700b7e95.js → chunk-env-node.67948209.js} +8 -11
  5. package/dist/{chunk-install-pkg.55bfe508.js → chunk-install-pkg.579a5a27.js} +2 -2
  6. package/dist/chunk-integrations-globals.796fe181.js +25 -0
  7. package/dist/{chunk-node-git.af5c9d73.js → chunk-node-git.5a1b1656.js} +3 -3
  8. package/dist/{chunk-runtime-chain.3b531731.js → chunk-runtime-chain.e387e274.js} +14 -7
  9. package/dist/{chunk-runtime-error.3cc15c6f.js → chunk-runtime-error.6287172c.js} +2 -2
  10. package/dist/{chunk-runtime-mocker.a5d87666.js → chunk-runtime-mocker.503a4f67.js} +4 -4
  11. package/dist/{chunk-runtime-rpc.4a2d45ab.js → chunk-runtime-rpc.1e7530d3.js} +2 -2
  12. package/dist/{chunk-runtime-setup.f644ac4c.js → chunk-runtime-setup.5c4e0f49.js} +33 -20
  13. package/dist/{chunk-runtime-test-state.31ce8643.js → chunk-runtime-test-state.4ed42543.js} +17 -4
  14. package/dist/{chunk-typecheck-constants.410fa7b2.js → chunk-typecheck-constants.4891f22f.js} +2 -2
  15. package/dist/{chunk-utils-env.7fe285cc.js → chunk-utils-env.03f840f2.js} +0 -0
  16. package/dist/{chunk-utils-source-map.1a66263d.js → chunk-utils-source-map.c6dfbbc1.js} +1 -1
  17. package/dist/{chunk-utils-timers.d1fcc6bb.js → chunk-utils-timers.06f993db.js} +1 -1
  18. package/dist/{chunk-vite-node-client.13ea0a59.js → chunk-vite-node-client.b2ab6dcf.js} +2 -2
  19. package/dist/{chunk-vite-node-externalize.01d0d22c.js → chunk-vite-node-externalize.477f36a4.js} +26 -26
  20. package/dist/{chunk-vite-node-utils.b89230f3.js → chunk-vite-node-utils.8f0b4a12.js} +1 -1
  21. package/dist/cli-wrapper.js +3 -3
  22. package/dist/cli.js +11 -11
  23. package/dist/config.d.ts +1 -1
  24. package/dist/entry.js +14 -13
  25. package/dist/environments.d.ts +1 -1
  26. package/dist/environments.js +1 -1
  27. package/dist/{index-b68b3c09.d.ts → index-2f5b6168.d.ts} +1 -1
  28. package/dist/index.d.ts +13 -4
  29. package/dist/index.js +8 -8
  30. package/dist/loader.js +3 -3
  31. package/dist/node.d.ts +2 -2
  32. package/dist/node.js +12 -12
  33. package/dist/suite.js +6 -6
  34. package/dist/{types-b3ff5eea.d.ts → types-f302dae9.d.ts} +20 -26
  35. package/dist/{vendor-index.16d769d7.js → vendor-index.737c3cff.js} +1 -1
  36. package/dist/{vendor-index.808a85a6.js → vendor-index.9c919048.js} +0 -0
  37. package/dist/{vendor-index.22806ffb.js → vendor-index.e1d4cf84.js} +0 -0
  38. package/dist/worker.js +8 -8
  39. package/package.json +3 -3
  40. package/dist/chunk-integrations-globals.391b3839.js +0 -25
@@ -1,7 +1,7 @@
1
- import { b as resolve, p as picocolors, j as join, c as basename, d as dirname, r as relative, e as distDir, f as rootDir, g as isAbsolute, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.7fe285cc.js';
1
+ import { b as resolve, p as picocolors, j as join, c as basename, d as dirname, r as relative, e as distDir, f as rootDir, g as isAbsolute, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.03f840f2.js';
2
2
  import { p as pLimit, s as someTasksAreOnly, i as interpretTaskModes, g as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.befed097.js';
3
- import { g as getEnvPackageName } from './chunk-env-node.700b7e95.js';
4
- import { T as TYPECHECK_SUITE, x as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$2, k as relativePath, y as getTests, e as getFullName, q as hasFailed, z as hasFailedSnapshot, B as getTypecheckTests, C as getSuites, D as isTypecheckTest, j as notNullish, l as shuffle, t as toArray$1, n as noop$1, E as deepMerge, b as getCallLastIndex, F as removeUndefinedValues, G as stdout } from './chunk-typecheck-constants.410fa7b2.js';
3
+ import { g as getEnvPackageName } from './chunk-env-node.67948209.js';
4
+ import { T as TYPECHECK_SUITE, x as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$2, k as relativePath, y as getTests, e as getFullName, q as hasFailed, z as hasFailedSnapshot, B as getTypecheckTests, C as getSuites, D as isTypecheckTest, j as notNullish, l as shuffle, t as toArray$1, n as noop$1, E as deepMerge, b as getCallLastIndex, F as removeUndefinedValues, G as stdout } from './chunk-typecheck-constants.4891f22f.js';
5
5
  import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
6
6
  import path$a from 'path';
7
7
  import url, { fileURLToPath } from 'url';
@@ -12,30 +12,30 @@ import util$2 from 'util';
12
12
  import require$$0$1 from 'stream';
13
13
  import require$$2 from 'events';
14
14
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
15
- import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.13ea0a59.js';
15
+ import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.b2ab6dcf.js';
16
16
  import { performance } from 'perf_hooks';
17
17
  import createDebug from 'debug';
18
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.b89230f3.js';
18
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.8f0b4a12.js';
19
19
  import { writeFile, rm } from 'fs/promises';
20
- import { e as execa } from './vendor-index.16d769d7.js';
20
+ import { e as execa } from './vendor-index.737c3cff.js';
21
21
  import { SourceMapConsumer } from 'source-map';
22
22
  import H from 'module';
23
23
  import { parse as parse$4 } from 'acorn';
24
24
  import { ancestor } from 'acorn-walk';
25
25
  import { MessageChannel } from 'worker_threads';
26
26
  import { Tinypool } from 'tinypool';
27
- import { c as stripAnsi, d as safeSetInterval, e as safeClearInterval, g as cliTruncate, s as safeSetTimeout, h as stringWidth, i as ansiStyles, j as sliceAnsi, a as stringify$5, u as unifiedDiff, b as safeClearTimeout } from './chunk-utils-timers.d1fcc6bb.js';
28
- import { p as parseStacktrace, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.1a66263d.js';
27
+ import { c as stripAnsi, d as safeSetInterval, e as safeClearInterval, g as cliTruncate, s as safeSetTimeout, h as stringWidth, i as ansiStyles, j as sliceAnsi, a as stringify$5, u as unifiedDiff, b as safeClearTimeout } from './chunk-utils-timers.06f993db.js';
28
+ import { p as parseStacktrace, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.c6dfbbc1.js';
29
29
  import { resolveModule } from 'local-pkg';
30
30
  import { createHash } from 'crypto';
31
- import { o as onetime } from './vendor-index.808a85a6.js';
32
- import { s as signalExit } from './vendor-index.22806ffb.js';
31
+ import { o as onetime } from './vendor-index.9c919048.js';
32
+ import { s as signalExit } from './vendor-index.e1d4cf84.js';
33
33
  import MagicString from './chunk-magic-string.ffe2b171.js';
34
34
  import { stripLiteral } from 'strip-literal';
35
35
  import require$$0$2 from 'readline';
36
36
  import { p as prompts } from './vendor-index.9f20a9be.js';
37
37
 
38
- var version$1 = "0.25.0";
38
+ var version$1 = "0.25.1";
39
39
 
40
40
  class EndError extends Error {
41
41
  constructor(value) {
@@ -7544,10 +7544,7 @@ class Typechecker {
7544
7544
  return this._result;
7545
7545
  }
7546
7546
  getTestFiles() {
7547
- return Object.values(this._tests || {}).map(({ file }) => ({
7548
- ...file,
7549
- result: void 0
7550
- }));
7547
+ return Object.values(this._tests || {}).map((i) => i.file);
7551
7548
  }
7552
7549
  }
7553
7550
 
@@ -8314,13 +8311,12 @@ class DefaultReporter extends BaseReporter {
8314
8311
  await super.reportSummary(files);
8315
8312
  super.onWatcherStart();
8316
8313
  }
8317
- onCollected(files) {
8314
+ onCollected() {
8318
8315
  if (this.isTTY) {
8319
8316
  this.rendererOptions.logger = this.ctx.logger;
8320
8317
  this.rendererOptions.showHeap = this.ctx.config.logHeapUsage;
8321
8318
  this.rendererOptions.mode = this.mode;
8322
- if (!files)
8323
- files = this.ctx.state.getFiles(this.watchFilters);
8319
+ const files = this.ctx.state.getFiles(this.watchFilters);
8324
8320
  if (!this.renderer)
8325
8321
  this.renderer = createListRenderer(files, this.rendererOptions).start();
8326
8322
  else
@@ -9588,7 +9584,7 @@ function resolveApiConfig(options) {
9588
9584
  return api;
9589
9585
  }
9590
9586
  function resolveConfig(mode, options, viteConfig) {
9591
- var _a, _b, _c, _d, _e, _f;
9587
+ var _a, _b, _c, _d, _e, _f, _g;
9592
9588
  if (options.dom) {
9593
9589
  if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
9594
9590
  console.warn(
@@ -9690,10 +9686,11 @@ function resolveConfig(mode, options, viteConfig) {
9690
9686
  resolved.cache ?? (resolved.cache = { dir: "" });
9691
9687
  if (resolved.cache)
9692
9688
  resolved.cache.dir = VitestCache.resolveCacheDir(resolved.root, resolved.cache.dir);
9689
+ resolved.sequence ?? (resolved.sequence = {});
9693
9690
  if (!((_f = resolved.sequence) == null ? void 0 : _f.sequencer)) {
9694
- resolved.sequence ?? (resolved.sequence = {});
9695
9691
  resolved.sequence.sequencer = resolved.sequence.shuffle ? RandomSequencer : BaseSequencer;
9696
9692
  }
9693
+ (_g = resolved.sequence).hooks ?? (_g.hooks = "parallel");
9697
9694
  resolved.typecheck = {
9698
9695
  ...configDefaults.typecheck,
9699
9696
  ...resolved.typecheck
@@ -10191,7 +10188,7 @@ createLogUpdate(process$1.stdout);
10191
10188
 
10192
10189
  createLogUpdate(process$1.stderr);
10193
10190
 
10194
- var version = "0.25.0";
10191
+ var version = "0.25.1";
10195
10192
 
10196
10193
  function fileFromParsedStack(stack) {
10197
10194
  var _a, _b;
@@ -10594,7 +10591,8 @@ class Vitest {
10594
10591
  const checker = new Typechecker(this, testsFilesList);
10595
10592
  this.typechecker = checker;
10596
10593
  checker.onParseEnd(async ({ files, sourceErrors }) => {
10597
- await this.report("onCollected", files);
10594
+ this.state.collectFiles(checker.getTestFiles());
10595
+ await this.report("onCollected");
10598
10596
  if (!files.length)
10599
10597
  this.logger.printNoTestFound();
10600
10598
  else
@@ -10616,12 +10614,14 @@ class Vitest {
10616
10614
  });
10617
10615
  checker.onParseStart(async () => {
10618
10616
  await this.report("onInit", this);
10619
- await this.report("onCollected", checker.getTestFiles());
10617
+ this.state.collectFiles(checker.getTestFiles());
10618
+ await this.report("onCollected");
10620
10619
  });
10621
10620
  checker.onWatcherRerun(async () => {
10622
10621
  await this.report("onWatcherRerun", testsFilesList, "File change detected. Triggering rerun.");
10623
10622
  await checker.collectTests();
10624
- await this.report("onCollected", checker.getTestFiles());
10623
+ this.state.collectFiles(checker.getTestFiles());
10624
+ await this.report("onCollected");
10625
10625
  });
10626
10626
  await checker.collectTests();
10627
10627
  await checker.start();
@@ -10678,7 +10678,7 @@ class Vitest {
10678
10678
  }
10679
10679
  async filterTestsBySource(tests) {
10680
10680
  if (this.config.changed && !this.config.related) {
10681
- const { VitestGit } = await import('./chunk-node-git.af5c9d73.js');
10681
+ const { VitestGit } = await import('./chunk-node-git.5a1b1656.js');
10682
10682
  const vitestGit = new VitestGit(this.config.root);
10683
10683
  const related2 = await vitestGit.findChangedFiles({
10684
10684
  changedSince: this.config.changed
@@ -11357,7 +11357,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11357
11357
  try {
11358
11358
  await ctx.setServer(options, server);
11359
11359
  if (options.api && options.watch)
11360
- (await import('./chunk-api-setup.a13c5f9d.js')).setup(ctx);
11360
+ (await import('./chunk-api-setup.f40616e2.js')).setup(ctx);
11361
11361
  } catch (err) {
11362
11362
  ctx.logger.printError(err, true);
11363
11363
  process.exit(1);
@@ -1,6 +1,6 @@
1
1
  import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'url';
2
2
  import fs, { promises, statSync, existsSync, realpathSync, Stats } from 'fs';
3
- import { b as resolve$1, r as relative } from './chunk-utils-env.7fe285cc.js';
3
+ import { b as resolve$1, r as relative } from './chunk-utils-env.03f840f2.js';
4
4
  import 'acorn';
5
5
  import { builtinModules } from 'module';
6
6
  import path from 'path';
@@ -1,12 +1,12 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.7fe285cc.js';
3
- import { e as execa } from './vendor-index.16d769d7.js';
2
+ import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.03f840f2.js';
3
+ import { e as execa } from './vendor-index.737c3cff.js';
4
4
  import 'tty';
5
5
  import 'path';
6
6
  import 'buffer';
7
7
  import 'child_process';
8
8
  import 'process';
9
- import './vendor-index.22806ffb.js';
9
+ import './vendor-index.e1d4cf84.js';
10
10
  import './vendor-_commonjsHelpers.addc3445.js';
11
11
  import 'fs';
12
12
  import 'assert';
package/dist/cli.js CHANGED
@@ -1,14 +1,14 @@
1
- import { p as picocolors, n as normalize } from './chunk-utils-env.7fe285cc.js';
1
+ import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
2
2
  import { EventEmitter } from 'events';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.01d0d22c.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.477f36a4.js';
4
4
  import 'tty';
5
5
  import 'url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
- import './chunk-env-node.700b7e95.js';
9
+ import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.410fa7b2.js';
11
+ import './chunk-typecheck-constants.4891f22f.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -16,27 +16,27 @@ import 'os';
16
16
  import 'util';
17
17
  import 'stream';
18
18
  import './vendor-_commonjsHelpers.addc3445.js';
19
- import './chunk-vite-node-client.13ea0a59.js';
19
+ import './chunk-vite-node-client.b2ab6dcf.js';
20
20
  import 'module';
21
21
  import 'vm';
22
- import './chunk-vite-node-utils.b89230f3.js';
22
+ import './chunk-vite-node-utils.8f0b4a12.js';
23
23
  import 'acorn';
24
24
  import 'assert';
25
25
  import 'debug';
26
26
  import 'perf_hooks';
27
27
  import 'fs/promises';
28
- import './vendor-index.16d769d7.js';
28
+ import './vendor-index.737c3cff.js';
29
29
  import 'buffer';
30
30
  import 'child_process';
31
- import './vendor-index.22806ffb.js';
31
+ import './vendor-index.e1d4cf84.js';
32
32
  import 'source-map';
33
33
  import 'acorn-walk';
34
34
  import 'worker_threads';
35
35
  import 'tinypool';
36
- import './chunk-utils-timers.d1fcc6bb.js';
37
- import './chunk-utils-source-map.1a66263d.js';
36
+ import './chunk-utils-timers.06f993db.js';
37
+ import './chunk-utils-source-map.c6dfbbc1.js';
38
38
  import 'crypto';
39
- import './vendor-index.808a85a6.js';
39
+ import './vendor-index.9c919048.js';
40
40
  import './chunk-magic-string.ffe2b171.js';
41
41
  import 'strip-literal';
42
42
  import 'readline';
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, am as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-b3ff5eea.js';
3
+ import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-f302dae9.js';
4
4
  import 'tinybench';
5
5
  import 'fs';
6
6
  import 'worker_threads';
package/dist/entry.js CHANGED
@@ -1,26 +1,26 @@
1
1
  import { promises } from 'fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.410fa7b2.js';
3
- import { a as envs } from './chunk-env-node.700b7e95.js';
4
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.f644ac4c.js';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.4891f22f.js';
3
+ import { v as vi } from './chunk-runtime-test-state.4ed42543.js';
4
+ import { a as envs } from './chunk-env-node.67948209.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.5c4e0f49.js';
5
6
  import 'path';
6
- import './chunk-utils-env.7fe285cc.js';
7
+ import './chunk-utils-env.03f840f2.js';
7
8
  import 'tty';
8
9
  import 'url';
9
10
  import 'local-pkg';
10
- import 'console';
11
- import 'perf_hooks';
12
- import './chunk-integrations-coverage.befed097.js';
13
- import './chunk-runtime-test-state.31ce8643.js';
14
- import './chunk-runtime-chain.3b531731.js';
11
+ import './chunk-runtime-chain.e387e274.js';
15
12
  import 'util';
16
13
  import 'chai';
17
14
  import './vendor-_commonjsHelpers.addc3445.js';
18
- import './chunk-runtime-rpc.4a2d45ab.js';
19
- import './chunk-utils-timers.d1fcc6bb.js';
20
- import './chunk-utils-source-map.1a66263d.js';
15
+ import './chunk-runtime-rpc.1e7530d3.js';
16
+ import './chunk-utils-timers.06f993db.js';
17
+ import './chunk-utils-source-map.c6dfbbc1.js';
21
18
  import './spy.js';
22
19
  import 'tinyspy';
23
- import './chunk-runtime-error.3cc15c6f.js';
20
+ import 'console';
21
+ import 'perf_hooks';
22
+ import './chunk-integrations-coverage.befed097.js';
23
+ import './chunk-runtime-error.6287172c.js';
24
24
  import 'source-map';
25
25
 
26
26
  function groupBy(collection, iteratee) {
@@ -73,6 +73,7 @@ async function run(files, config) {
73
73
  workerState.filepath = file;
74
74
  await startTests([file], config);
75
75
  workerState.filepath = void 0;
76
+ vi.resetConfig();
76
77
  }
77
78
  });
78
79
  }
@@ -1,4 +1,4 @@
1
- import { ac as Environment } from './types-b3ff5eea.js';
1
+ import { ae as Environment } from './types-f302dae9.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
4
  import 'fs';
@@ -1,3 +1,3 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.700b7e95.js';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.67948209.js';
2
2
  import 'console';
3
3
  import 'local-pkg';
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { u as SuiteAPI, t as TestAPI, au as BenchmarkAPI, w as SuiteHooks, H as HookListener, G as TestContext, S as Suite, v as HookCleanupCallback, O as OnTestFailedHandler, o as Test } from './types-b3ff5eea.js';
2
+ import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-f302dae9.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-b68b3c09.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-b68b3c09.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './types-b3ff5eea.js';
4
- export { $ as AfterSuiteRunMeta, A as ApiConfig, a5 as ArgumentsType, a4 as Arrayable, a2 as Awaitable, an as BaseCoverageOptions, at as BenchFunction, ar as Benchmark, au as BenchmarkAPI, as as BenchmarkResult, aq as BenchmarkUserOptions, B as BuiltinEnvironment, h as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, a9 as Constructable, g as Context, ap as CoverageC8Options, ao as CoverageIstanbulOptions, al as CoverageOptions, ai as CoverageProvider, aj as CoverageProviderModule, ak as CoverageReporter, a7 as DeepMerge, D as DoneCallback, ac as Environment, E as EnvironmentOptions, ab as EnvironmentReturn, ag as ErrorWithDiff, a as File, v as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a6 as MergeInsertions, aa as ModuleCache, M as ModuleGraphData, a8 as MutableArray, a3 as Nullable, ah as OnServerRestartHandler, O as OnTestFailedHandler, af as ParsedStack, ae as Position, c as RawErrsMap, b as Reporter, _ as ResolveIdFunction, R as ResolvedConfig, am as ResolvedCoverageOptions, f as RootAndTarget, k as RunMode, z as RuntimeContext, L as SnapshotData, Q as SnapshotMatchOptions, W as SnapshotResult, P as SnapshotStateOptions, Y as SnapshotSummary, N as SnapshotUpdateState, S as Suite, u as SuiteAPI, x as SuiteCollector, y as SuiteFactory, w as SuiteHooks, q as Task, m as TaskBase, n as TaskResult, T as TaskResultPack, l as TaskState, o as Test, t as TestAPI, G as TestContext, r as TestFunction, s as TestOptions, d as TscErrorInfo, p as TypeCheck, j as TypecheckConfig, X as UncheckedSnapshot, U as UserConfig, ad as UserConsoleLog, K as Vitest, V as VitestEnvironment, i as VitestRunMode, Z as WorkerContext, a1 as WorkerGlobalState, a0 as WorkerRPC } from './types-b3ff5eea.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-2f5b6168.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-2f5b6168.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-f302dae9.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, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l 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, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-f302dae9.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
@@ -149,6 +149,15 @@ declare class VitestUtils {
149
149
  * importing a module, that you cannot wait otherwise.
150
150
  */
151
151
  dynamicImportSettled(): Promise<void>;
152
+ private _config;
153
+ /**
154
+ * Updates runtime config. You can only change values that are used when executing tests.
155
+ */
156
+ setConfig(config: RuntimeConfig): void;
157
+ /**
158
+ * If config was changed with `vi.setConfig`, this will reset it to the original state.
159
+ */
160
+ resetConfig(): void;
152
161
  }
153
162
  declare const vitest: VitestUtils;
154
163
  declare const vi: VitestUtils;
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
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.3b531731.js';
2
- import { e as dist } from './chunk-runtime-test-state.31ce8643.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-runtime-test-state.31ce8643.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.e387e274.js';
2
+ import { e as dist } from './chunk-runtime-test-state.4ed42543.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-runtime-test-state.4ed42543.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-typecheck-constants.410fa7b2.js';
8
+ import './chunk-typecheck-constants.4891f22f.js';
9
9
  import 'path';
10
- import './chunk-utils-env.7fe285cc.js';
10
+ import './chunk-utils-env.03f840f2.js';
11
11
  import 'tty';
12
12
  import 'url';
13
13
  import 'local-pkg';
14
14
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.4a2d45ab.js';
16
- import './chunk-utils-timers.d1fcc6bb.js';
15
+ import './chunk-runtime-rpc.1e7530d3.js';
16
+ import './chunk-utils-timers.06f993db.js';
17
17
  import 'fs';
18
- import './chunk-utils-source-map.1a66263d.js';
18
+ import './chunk-utils-source-map.c6dfbbc1.js';
19
19
  import './spy.js';
20
20
  import 'tinyspy';
21
21
 
package/dist/loader.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { pathToFileURL } from 'url';
2
2
  import { readFile } from 'fs/promises';
3
- import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.b89230f3.js';
4
- import { g as getWorkerState } from './chunk-typecheck-constants.410fa7b2.js';
3
+ import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.8f0b4a12.js';
4
+ import { g as getWorkerState } from './chunk-typecheck-constants.4891f22f.js';
5
5
  import 'fs';
6
- import './chunk-utils-env.7fe285cc.js';
6
+ import './chunk-utils-env.03f840f2.js';
7
7
  import 'tty';
8
8
  import 'path';
9
9
  import 'acorn';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as VitestRunMode, U as UserConfig, K as Vitest, av as ModuleCacheMap, aw as ViteNodeRunnerOptions, ax as MockMap, ay as ViteNodeRunner, az as TestSequencer } from './types-b3ff5eea.js';
2
- export { az as TestSequencer, aB as TestSequencerConstructor, K as Vitest, aA as startVitest } from './types-b3ff5eea.js';
1
+ import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as ModuleCacheMap, ay as ViteNodeRunnerOptions, az as MockMap, aA as ViteNodeRunner, aB as TestSequencer } from './types-f302dae9.js';
2
+ export { aB as TestSequencer, aD as TestSequencerConstructor, N as Vitest, aC as startVitest } from './types-f302dae9.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import 'tinybench';
5
5
  import 'fs';
package/dist/node.js CHANGED
@@ -1,14 +1,14 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.01d0d22c.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.a5d87666.js';
3
- import './chunk-utils-env.7fe285cc.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.477f36a4.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.503a4f67.js';
3
+ import './chunk-utils-env.03f840f2.js';
4
4
  import 'tty';
5
5
  import 'url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
- import './chunk-env-node.700b7e95.js';
9
+ import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.410fa7b2.js';
11
+ import './chunk-typecheck-constants.4891f22f.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -17,27 +17,27 @@ import 'util';
17
17
  import 'stream';
18
18
  import 'events';
19
19
  import './vendor-_commonjsHelpers.addc3445.js';
20
- import './chunk-vite-node-client.13ea0a59.js';
20
+ import './chunk-vite-node-client.b2ab6dcf.js';
21
21
  import 'module';
22
22
  import 'vm';
23
- import './chunk-vite-node-utils.b89230f3.js';
23
+ import './chunk-vite-node-utils.8f0b4a12.js';
24
24
  import 'acorn';
25
25
  import 'assert';
26
26
  import 'debug';
27
27
  import 'perf_hooks';
28
28
  import 'fs/promises';
29
- import './vendor-index.16d769d7.js';
29
+ import './vendor-index.737c3cff.js';
30
30
  import 'buffer';
31
31
  import 'child_process';
32
- import './vendor-index.22806ffb.js';
32
+ import './vendor-index.e1d4cf84.js';
33
33
  import 'source-map';
34
34
  import 'acorn-walk';
35
35
  import 'worker_threads';
36
36
  import 'tinypool';
37
- import './chunk-utils-timers.d1fcc6bb.js';
38
- import './chunk-utils-source-map.1a66263d.js';
37
+ import './chunk-utils-timers.06f993db.js';
38
+ import './chunk-utils-source-map.c6dfbbc1.js';
39
39
  import 'crypto';
40
- import './vendor-index.808a85a6.js';
40
+ import './vendor-index.9c919048.js';
41
41
  import './chunk-magic-string.ffe2b171.js';
42
42
  import 'strip-literal';
43
43
  import 'readline';
package/dist/suite.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import 'util';
2
- import './chunk-typecheck-constants.410fa7b2.js';
3
- export { b as bench, f as clearCollectorContext, p as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.3b531731.js';
2
+ import './chunk-typecheck-constants.4891f22f.js';
3
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.e387e274.js';
4
4
  import 'path';
5
- import './chunk-utils-env.7fe285cc.js';
5
+ import './chunk-utils-env.03f840f2.js';
6
6
  import 'tty';
7
7
  import 'url';
8
8
  import 'local-pkg';
9
9
  import 'chai';
10
10
  import './vendor-_commonjsHelpers.addc3445.js';
11
- import './chunk-runtime-rpc.4a2d45ab.js';
12
- import './chunk-utils-timers.d1fcc6bb.js';
11
+ import './chunk-runtime-rpc.1e7530d3.js';
12
+ import './chunk-utils-timers.06f993db.js';
13
13
  import 'fs';
14
- import './chunk-utils-source-map.1a66263d.js';
14
+ import './chunk-utils-source-map.c6dfbbc1.js';
15
15
  import './spy.js';
16
16
  import 'tinyspy';
@@ -1,6 +1,5 @@
1
1
  import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, CommonServerOptions, AliasOptions } from 'vite';
2
- import * as tinybench from 'tinybench';
3
- import { Task as Task$1, Options, TaskResult as TaskResult$1, Bench } from 'tinybench';
2
+ import { Task as Task$1, TaskResult as TaskResult$1, Bench, Options } from 'tinybench';
4
3
  import { Stats } from 'fs';
5
4
  import { MessagePort } from 'worker_threads';
6
5
 
@@ -453,7 +452,7 @@ interface LocalCallDefinition {
453
452
  task: ParsedSuite | ParsedFile;
454
453
  }
455
454
  interface FileInformation {
456
- file: ParsedFile;
455
+ file: File;
457
456
  filepath: string;
458
457
  parsed: string;
459
458
  map: RawSourceMap | null;
@@ -500,26 +499,7 @@ declare class Typechecker {
500
499
  protected ensurePackageInstalled(root: string, checker: string): Promise<void>;
501
500
  start(): Promise<void>;
502
501
  getResult(): ErrorsCache;
503
- getTestFiles(): {
504
- result: undefined;
505
- start: number;
506
- end: number;
507
- filepath: string;
508
- collectDuration?: number | undefined;
509
- setupDuration?: number | undefined;
510
- type: "suite";
511
- tasks: Task[];
512
- benchmark?: tinybench.Bench | undefined;
513
- id: string;
514
- name: string;
515
- mode: RunMode;
516
- concurrent?: boolean | undefined;
517
- shuffle?: boolean | undefined;
518
- suite?: Suite | undefined;
519
- file?: File | undefined;
520
- retry?: number | undefined;
521
- logs?: UserConsoleLog[] | undefined;
522
- }[];
502
+ getTestFiles(): File[];
523
503
  }
524
504
 
525
505
  declare type RunWithFiles = (files: string[], invalidates?: string[]) => Promise<void>;
@@ -755,7 +735,7 @@ declare class DefaultReporter extends BaseReporter {
755
735
  renderer?: ReturnType<typeof createListRenderer>;
756
736
  rendererOptions: ListRendererOptions$1;
757
737
  onTestRemoved(trigger?: string): Promise<void>;
758
- onCollected(files?: File[]): void;
738
+ onCollected(): void;
759
739
  onFinished(files?: File[], errors?: unknown[]): Promise<void>;
760
740
  onWatcherStart(files?: File[], errors?: unknown[]): Promise<void>;
761
741
  stopListRender(): Promise<void>;
@@ -1209,7 +1189,6 @@ interface Benchmark extends TaskBase {
1209
1189
  result?: TaskResult;
1210
1190
  fails?: boolean;
1211
1191
  task?: Task$1;
1212
- options: Options;
1213
1192
  }
1214
1193
  interface BenchmarkResult extends TaskResult$1 {
1215
1194
  name: string;
@@ -1687,6 +1666,7 @@ interface Reporter {
1687
1666
  declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
1688
1667
  declare type VitestEnvironment = BuiltinEnvironment | (string & Record<never, never>);
1689
1668
  declare type CSSModuleScopeStrategy = 'stable' | 'scoped' | 'non-scoped';
1669
+ declare type SequenceHooks = 'stack' | 'list' | 'parallel';
1690
1670
  declare type ApiConfig = Pick<CommonServerOptions, 'port' | 'strictPort' | 'host'>;
1691
1671
 
1692
1672
  interface EnvironmentOptions {
@@ -2046,6 +2026,14 @@ interface InlineConfig {
2046
2026
  * @default Date.now()
2047
2027
  */
2048
2028
  seed?: number;
2029
+ /**
2030
+ * Defines how hooks should be ordered
2031
+ * - `stack` will order "after" hooks in reverse order, "before" hooks will run sequentially
2032
+ * - `list` will order hooks in the order they are defined
2033
+ * - `parallel` will run hooks in a single group in parallel
2034
+ * @default 'parallel'
2035
+ */
2036
+ hooks?: SequenceHooks;
2049
2037
  };
2050
2038
  /**
2051
2039
  * Specifies an `Object`, or an `Array` of `Object`,
@@ -2147,11 +2135,17 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
2147
2135
  } | false;
2148
2136
  sequence: {
2149
2137
  sequencer: TestSequencerConstructor;
2138
+ hooks: SequenceHooks;
2150
2139
  shuffle?: boolean;
2151
2140
  seed?: number;
2152
2141
  };
2153
2142
  typecheck: TypecheckConfig;
2154
2143
  }
2144
+ declare type RuntimeConfig = Pick<UserConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency'> & {
2145
+ sequence?: {
2146
+ hooks?: SequenceHooks;
2147
+ };
2148
+ };
2155
2149
 
2156
2150
  declare type VitestInlineConfig = InlineConfig;
2157
2151
  declare module 'vite' {
@@ -2440,4 +2434,4 @@ declare type Context = RootAndTarget & {
2440
2434
  lastActivePath?: string;
2441
2435
  };
2442
2436
 
2443
- export { AfterSuiteRunMeta as $, ApiConfig as A, BuiltinEnvironment as B, CollectLineNumbers as C, DoneCallback as D, EnvironmentOptions as E, FakeTimerInstallOpts as F, TestContext as G, HookListener as H, InlineConfig as I, JSDOMOptions as J, Vitest as K, SnapshotData as L, ModuleGraphData as M, SnapshotUpdateState as N, OnTestFailedHandler as O, SnapshotStateOptions as P, SnapshotMatchOptions as Q, ResolvedConfig as R, Suite as S, TaskResultPack as T, UserConfig as U, VitestEnvironment as V, SnapshotResult as W, UncheckedSnapshot as X, SnapshotSummary as Y, WorkerContext as Z, ResolveIdFunction as _, File as a, WorkerRPC as a0, WorkerGlobalState as a1, Awaitable as a2, Nullable as a3, Arrayable as a4, ArgumentsType$1 as a5, MergeInsertions as a6, DeepMerge as a7, MutableArray as a8, Constructable as a9, startVitest as aA, TestSequencerConstructor as aB, ModuleCache as aa, EnvironmentReturn as ab, Environment as ac, UserConsoleLog as ad, Position as ae, ParsedStack as af, ErrorWithDiff as ag, OnServerRestartHandler as ah, CoverageProvider as ai, CoverageProviderModule as aj, CoverageReporter as ak, CoverageOptions as al, ResolvedCoverageOptions as am, BaseCoverageOptions as an, CoverageIstanbulOptions as ao, CoverageC8Options as ap, BenchmarkUserOptions as aq, Benchmark as ar, BenchmarkResult as as, BenchFunction as at, BenchmarkAPI as au, ModuleCacheMap as av, ViteNodeRunnerOptions as aw, MockMap as ax, ViteNodeRunner as ay, TestSequencer as az, Reporter as b, RawErrsMap as c, TscErrorInfo as d, CollectLines as e, RootAndTarget as f, Context as g, CSSModuleScopeStrategy as h, VitestRunMode as i, TypecheckConfig as j, RunMode as k, TaskState as l, TaskBase as m, TaskResult as n, Test as o, TypeCheck as p, Task as q, TestFunction as r, TestOptions as s, TestAPI as t, SuiteAPI as u, HookCleanupCallback as v, SuiteHooks as w, SuiteCollector as x, SuiteFactory as y, RuntimeContext as z };
2437
+ 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, ModuleGraphData 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, ViteNodeRunner as aA, TestSequencer as aB, startVitest as aC, TestSequencerConstructor as aD, MutableArray as aa, Constructable as ab, ModuleCache as ac, EnvironmentReturn as ad, Environment as ae, UserConsoleLog as af, Position as ag, ParsedStack as ah, ErrorWithDiff as ai, OnServerRestartHandler as aj, CoverageProvider 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, ModuleCacheMap as ax, ViteNodeRunnerOptions as ay, MockMap as az, ResolvedConfig as b, Reporter as c, RawErrsMap as d, TscErrorInfo as e, CollectLines as f, RootAndTarget as g, Context as h, CSSModuleScopeStrategy as i, VitestRunMode as j, TypecheckConfig as k, RunMode as l, TaskState as m, TaskBase as n, TaskResult as o, Suite as p, Test as q, TypeCheck 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 };
@@ -2,7 +2,7 @@ import { Buffer } from 'buffer';
2
2
  import path from 'path';
3
3
  import childProcess from 'child_process';
4
4
  import process$1 from 'process';
5
- import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.22806ffb.js';
5
+ import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.e1d4cf84.js';
6
6
  import url from 'url';
7
7
  import require$$0, { constants } from 'os';
8
8