vitest 0.31.2 → 0.31.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { a as ResolvedConfig, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule } from './types-73d6349f.js';
2
+ import { a as ResolvedConfig, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule } from './types-dea83b3d.js';
3
3
  import '@vitest/snapshot';
4
4
  import '@vitest/expect';
5
5
  import 'vite';
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- export { s as setupCommonEnv } from './vendor-setup.common.3c71d21d.js';
2
+ export { s as setupCommonEnv } from './vendor-setup.common.823a1300.js';
3
3
  export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.c8fd34c3.js';
4
4
  import '@vitest/utils';
5
5
  import './vendor-run-once.69ce7172.js';
@@ -3,7 +3,7 @@ import p from 'path';
3
3
  import require$$0$1 from 'util';
4
4
  import require$$0$3 from 'child_process';
5
5
  import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.c1e09929.js';
6
- import { o as onetime$1 } from './vendor-cli-api.35332ab3.js';
6
+ import { o as onetime$1 } from './vendor-cli-api.8cf937e8.js';
7
7
  import require$$0$2 from 'os';
8
8
  import 'node:buffer';
9
9
  import 'node:path';
@@ -41,7 +41,7 @@ import './vendor-index.5037f2c0.js';
41
41
  import 'node:worker_threads';
42
42
  import 'tinypool';
43
43
  import 'node:perf_hooks';
44
- import './vendor-tasks.042d6084.js';
44
+ import './vendor-tasks.f9d75aed.js';
45
45
  import 'node:module';
46
46
  import 'node:crypto';
47
47
  import 'node:fs/promises';
@@ -1,7 +1,7 @@
1
1
  import { g as globalApis } from './vendor-constants.538d9b49.js';
2
- import { i as index } from './vendor-index.c8d81526.js';
2
+ import { i as index } from './vendor-index.f81f6285.js';
3
3
  import '@vitest/runner';
4
- import './vendor-vi.c6384282.js';
4
+ import './vendor-vi.23b98fa1.js';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
7
7
  import './vendor-index.fad2598b.js';
@@ -12,7 +12,7 @@ import 'chai';
12
12
  import './vendor-_commonjsHelpers.76cdd49e.js';
13
13
  import '@vitest/expect';
14
14
  import '@vitest/snapshot';
15
- import './vendor-tasks.042d6084.js';
15
+ import './vendor-tasks.f9d75aed.js';
16
16
  import 'util';
17
17
  import '@vitest/spy';
18
18
  import './vendor-run-once.69ce7172.js';
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest, d as divider } from './vendor-cli-api.35332ab3.js';
4
+ import { v as version, s as startVitest, d as divider } from './vendor-cli-api.8cf937e8.js';
5
5
  import './vendor-constants.538d9b49.js';
6
6
  import './vendor-coverage.c8fd34c3.js';
7
7
  import './vendor-index.75f2b63d.js';
@@ -36,7 +36,7 @@ import 'node:worker_threads';
36
36
  import 'node:os';
37
37
  import 'tinypool';
38
38
  import 'node:perf_hooks';
39
- import './vendor-tasks.042d6084.js';
39
+ import './vendor-tasks.f9d75aed.js';
40
40
  import 'node:module';
41
41
  import 'node:crypto';
42
42
  import './vendor-index.c1e09929.js';
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
3
- import { a0 as ResolvedCoverageOptions, q as UserConfig, a3 as CoverageC8Options, a4 as CustomProviderOptions, a2 as CoverageIstanbulOptions, ag as HtmlOptions, ah as FileOptions, ai as CloverOptions, aj as CoberturaOptions, ak as HtmlSpaOptions, al as LcovOptions, am as LcovOnlyOptions, an as TeamcityOptions, ao as TextOptions, ap as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-73d6349f.js';
3
+ import { a0 as ResolvedCoverageOptions, q as UserConfig, a3 as CoverageC8Options, a4 as CustomProviderOptions, a2 as CoverageIstanbulOptions, ag as HtmlOptions, ah as FileOptions, ai as CloverOptions, aj as CoberturaOptions, ak as HtmlSpaOptions, al as LcovOptions, am as LcovOnlyOptions, an as TeamcityOptions, ao as TextOptions, ap as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-dea83b3d.js';
4
4
  import '@vitest/snapshot';
5
5
  import '@vitest/expect';
6
6
  import '@vitest/runner';
@@ -1,4 +1,4 @@
1
- import { a1 as BaseCoverageOptions, a0 as ResolvedCoverageOptions } from './types-73d6349f.js';
1
+ import { a1 as BaseCoverageOptions, a0 as ResolvedCoverageOptions } from './types-dea83b3d.js';
2
2
  import '@vitest/snapshot';
3
3
  import '@vitest/expect';
4
4
  import 'vite';
package/dist/entry.js CHANGED
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
2
2
  import { startTests } from '@vitest/runner';
3
3
  import { resolve } from 'pathe';
4
4
  import { c as resetModules } from './vendor-index.fad2598b.js';
5
- import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.c6384282.js';
5
+ import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.23b98fa1.js';
6
6
  import { d as distDir } from './vendor-paths.84fc7a99.js';
7
7
  import { a as startCoverageInsideWorker, t as takeCoverageInsideWorker, s as stopCoverageInsideWorker } from './vendor-coverage.c8fd34c3.js';
8
8
  import { createRequire } from 'node:module';
@@ -12,8 +12,8 @@ import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
12
12
  import { e as environments } from './vendor-index.75f2b63d.js';
13
13
  import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
14
14
  import { r as rpc } from './vendor-rpc.4d3d7a54.js';
15
- import { i as index } from './vendor-index.c8d81526.js';
16
- import { s as setupCommonEnv } from './vendor-setup.common.3c71d21d.js';
15
+ import { i as index } from './vendor-index.f81f6285.js';
16
+ import { s as setupCommonEnv } from './vendor-setup.common.823a1300.js';
17
17
  import { g as getWorkerState } from './vendor-global.6795f91f.js';
18
18
  import 'std-env';
19
19
  import '@vitest/runner/utils';
@@ -21,7 +21,7 @@ import 'chai';
21
21
  import './vendor-_commonjsHelpers.76cdd49e.js';
22
22
  import '@vitest/expect';
23
23
  import '@vitest/snapshot';
24
- import './vendor-tasks.042d6084.js';
24
+ import './vendor-tasks.f9d75aed.js';
25
25
  import 'util';
26
26
  import '@vitest/spy';
27
27
  import 'node:url';
@@ -1,4 +1,4 @@
1
- import { Q as Environment } from './types-73d6349f.js';
1
+ import { Q as Environment } from './types-dea83b3d.js';
2
2
  import '@vitest/snapshot';
3
3
  import '@vitest/expect';
4
4
  import 'vite';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { File, TaskResultPack, CancelReason } from '@vitest/runner';
2
2
  export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, A as AfterSuiteRunMeta, U as UserConsoleLog, a as ResolvedConfig, b as ModuleGraphData, c as Reporter } from './types-73d6349f.js';
4
- export { n as ApiConfig, G as ArgumentsType, D as Arrayable, z as Awaitable, a1 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, K as Constructable, j as Context, v as ContextRPC, u as ContextTestEnvironment, a3 as CoverageC8Options, a2 as CoverageIstanbulOptions, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule, _ as CoverageReporter, a4 as CustomProviderOptions, Q as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, L as ModuleCache, H as MutableArray, N as Nullable, S as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, Y as ReportContext, x as ResolveIdFunction, a0 as ResolvedCoverageOptions, i as RootAndTarget, t as RunnerRPC, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, w as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, y as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-73d6349f.js';
3
+ import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, A as AfterSuiteRunMeta, U as UserConsoleLog, a as ResolvedConfig, b as ModuleGraphData, c as Reporter } from './types-dea83b3d.js';
4
+ export { n as ApiConfig, G as ArgumentsType, D as Arrayable, z as Awaitable, a1 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, K as Constructable, j as Context, v as ContextRPC, u as ContextTestEnvironment, a3 as CoverageC8Options, a2 as CoverageIstanbulOptions, $ as CoverageOptions, X as CoverageProvider, Z as CoverageProviderModule, _ as CoverageReporter, a4 as CustomProviderOptions, Q as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, L as ModuleCache, H as MutableArray, N as Nullable, S as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, Y as ReportContext, x as ResolveIdFunction, a0 as ResolvedCoverageOptions, i as RootAndTarget, t as RunnerRPC, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, w as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, y as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-dea83b3d.js';
5
5
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
6
6
  export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
7
7
  export { SnapshotEnvironment } from '@vitest/snapshot/environment';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.c6384282.js';
2
+ export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.23b98fa1.js';
3
3
  export { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
4
- import { d as dist } from './vendor-index.c8d81526.js';
5
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.c8d81526.js';
4
+ import { d as dist } from './vendor-index.f81f6285.js';
5
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.f81f6285.js';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
@@ -15,7 +15,7 @@ import './vendor-global.6795f91f.js';
15
15
  import './vendor-_commonjsHelpers.76cdd49e.js';
16
16
  import '@vitest/expect';
17
17
  import '@vitest/snapshot';
18
- import './vendor-tasks.042d6084.js';
18
+ import './vendor-tasks.f9d75aed.js';
19
19
  import 'util';
20
20
  import '@vitest/spy';
21
21
 
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as VitestRunMode, q as UserConfig, w as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer, ac as WorkspaceSpec } from './types-73d6349f.js';
2
- export { af as TestSequencerConstructor, ad as VitestWorkspace, ae as startVitest } from './types-73d6349f.js';
1
+ import { o as VitestRunMode, q as UserConfig, w as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer, ac as WorkspaceSpec } from './types-dea83b3d.js';
2
+ export { af as TestSequencerConstructor, ad as VitestWorkspace, ae as startVitest } from './types-dea83b3d.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,4 +1,4 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './vendor-cli-api.35332ab3.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './vendor-cli-api.8cf937e8.js';
2
2
  export { V as VitestExecutor } from './vendor-execute.132a3e09.js';
3
3
  import 'pathe';
4
4
  import './vendor-constants.538d9b49.js';
@@ -36,7 +36,7 @@ import 'node:worker_threads';
36
36
  import 'node:os';
37
37
  import 'tinypool';
38
38
  import 'node:perf_hooks';
39
- import './vendor-tasks.042d6084.js';
39
+ import './vendor-tasks.f9d75aed.js';
40
40
  import 'node:module';
41
41
  import 'node:crypto';
42
42
  import './vendor-index.c1e09929.js';
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, TestContext } from '@vitest/runner';
2
- import { a as ResolvedConfig } from './types-73d6349f.js';
2
+ import { a as ResolvedConfig } from './types-dea83b3d.js';
3
3
  import '@vitest/snapshot';
4
4
  import '@vitest/expect';
5
5
  import 'vite';
package/dist/runners.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.c6384282.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.23b98fa1.js';
3
3
  import './vendor-index.fad2598b.js';
4
4
  import { r as rpc } from './vendor-rpc.4d3d7a54.js';
5
- import { g as getFullName } from './vendor-tasks.042d6084.js';
5
+ import { g as getFullName } from './vendor-tasks.f9d75aed.js';
6
6
  import { g as getWorkerState } from './vendor-global.6795f91f.js';
7
7
  import { getNames } from '@vitest/runner/utils';
8
8
  import { performance } from 'node:perf_hooks';
@@ -571,8 +571,8 @@ declare abstract class BaseReporter implements Reporter {
571
571
  onUserConsoleLog(log: UserConsoleLog): void;
572
572
  shouldLog(log: UserConsoleLog): boolean;
573
573
  onServerRestart(reason?: string): void;
574
- reportSummary(files: File[]): Promise<void>;
575
- reportTestSummary(files: File[]): Promise<void>;
574
+ reportSummary(files: File[], errors: unknown[]): Promise<void>;
575
+ reportTestSummary(files: File[], errors: unknown[]): Promise<void>;
576
576
  private printErrorsSummary;
577
577
  reportBenchmarkSummary(files: File[]): Promise<void>;
578
578
  private printTaskErrors;
@@ -581,7 +581,7 @@ declare abstract class BaseReporter implements Reporter {
581
581
 
582
582
  declare class BasicReporter extends BaseReporter {
583
583
  isTTY: boolean;
584
- reportSummary(files: File[]): Promise<void>;
584
+ reportSummary(files: File[], errors: unknown[]): Promise<void>;
585
585
  }
586
586
 
587
587
  type Awaitable<T> = T | PromiseLike<T>;
@@ -1327,7 +1327,7 @@ interface DepsOptions {
1327
1327
  /**
1328
1328
  * Enable dependency optimization. This can improve the performance of your tests.
1329
1329
  */
1330
- experimentalOptimizer?: Omit<DepOptimizationConfig, 'disabled'> & {
1330
+ experimentalOptimizer?: Omit<DepOptimizationConfig, 'disabled' | 'noDiscovery'> & {
1331
1331
  enabled: boolean;
1332
1332
  };
1333
1333
  /**
@@ -7,7 +7,7 @@ import c from 'picocolors';
7
7
  import { isPackageExists, resolveModule } from 'local-pkg';
8
8
  import { i as isNode, r as relativePath, a as removeUndefinedValues, b as isWindows } from './vendor-index.fad2598b.js';
9
9
  import { isCI } from 'std-env';
10
- import { loadConfigFromFile, createServer, mergeConfig } from 'vite';
10
+ import { loadConfigFromFile, createServer, version as version$2, mergeConfig } from 'vite';
11
11
  import path$a from 'node:path';
12
12
  import process$1 from 'node:process';
13
13
  import fs$8, { promises, existsSync, readFileSync } from 'node:fs';
@@ -31,9 +31,9 @@ import { cpus, hostname } from 'node:os';
31
31
  import Tinypool from 'tinypool';
32
32
  import { createDefer, getSafeTimers, notNullish, parseErrorStacktrace, shuffle, stringify as stringify$5, positionToOffset, lineSplitRE } from '@vitest/utils';
33
33
  import { performance } from 'node:perf_hooks';
34
- import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.042d6084.js';
34
+ import { g as getFullName, h as hasFailedSnapshot } from './vendor-tasks.f9d75aed.js';
35
35
  import { getTests, hasFailed, getSuites, generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks } from '@vitest/runner/utils';
36
- import { createRequire } from 'node:module';
36
+ import { createRequire, builtinModules } from 'node:module';
37
37
  import { createHash } from 'node:crypto';
38
38
  import { s as signalExit, e as execa } from './vendor-index.c1e09929.js';
39
39
  import { writeFile, rm } from 'node:fs/promises';
@@ -60,7 +60,7 @@ function _mergeNamespaces(n, m) {
60
60
  return Object.freeze(n);
61
61
  }
62
62
 
63
- var version$1 = "0.31.2";
63
+ var version$1 = "0.31.4";
64
64
 
65
65
  const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
66
66
  async function ensurePackageInstalled(dependency, root) {
@@ -79,7 +79,7 @@ async function ensurePackageInstalled(dependency, root) {
79
79
  message: c.reset(`Do you want to install ${c.green(dependency)}?`)
80
80
  });
81
81
  if (install) {
82
- await (await import('./chunk-install-pkg.4207d842.js')).installPackage(dependency, { dev: true });
82
+ await (await import('./chunk-install-pkg.4f68b0aa.js')).installPackage(dependency, { dev: true });
83
83
  process.stderr.write(c.yellow(`
84
84
  Package ${dependency} installed, re-run the command to start.
85
85
  `));
@@ -7676,11 +7676,10 @@ class BaseReporter {
7676
7676
  }
7677
7677
  async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
7678
7678
  this.end = performance.now();
7679
- await this.reportSummary(files);
7679
+ await this.reportSummary(files, errors);
7680
7680
  if (errors.length) {
7681
7681
  if (!this.ctx.config.dangerouslyIgnoreUnhandledErrors)
7682
7682
  process.exitCode = 1;
7683
- await this.ctx.logger.printUnhandledErrors(errors);
7684
7683
  }
7685
7684
  }
7686
7685
  onTaskUpdate(packs) {
@@ -7821,14 +7820,14 @@ ${log.content}
7821
7820
  reason === "config" ? "\nRestarting due to config changes..." : "\nRestarting Vitest..."
7822
7821
  )));
7823
7822
  }
7824
- async reportSummary(files) {
7825
- await this.printErrorsSummary(files);
7823
+ async reportSummary(files, errors) {
7824
+ await this.printErrorsSummary(files, errors);
7826
7825
  if (this.mode === "benchmark")
7827
7826
  await this.reportBenchmarkSummary(files);
7828
7827
  else
7829
- await this.reportTestSummary(files);
7828
+ await this.reportTestSummary(files, errors);
7830
7829
  }
7831
- async reportTestSummary(files) {
7830
+ async reportTestSummary(files, errors) {
7832
7831
  const tests = getTests(files);
7833
7832
  const logger = this.ctx.logger;
7834
7833
  const executionTime = this.end - this.start;
@@ -7865,6 +7864,8 @@ ${log.content}
7865
7864
  });
7866
7865
  logger.log(padTitle("Type Errors"), failed.length ? c.bold(c.red(`${failed.length} failed`)) : c.dim("no errors"));
7867
7866
  }
7867
+ if (errors.length)
7868
+ logger.log(padTitle("Errors"), c.bold(c.red(`${errors.length} error${errors.length > 1 ? "s" : ""}`)));
7868
7869
  logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
7869
7870
  if (this.watchFilters)
7870
7871
  logger.log(padTitle("Duration"), time(threadTime));
@@ -7874,7 +7875,7 @@ ${log.content}
7874
7875
  logger.log(padTitle("Duration"), time(executionTime) + c.dim(` (transform ${time(transformTime)}, setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)}, environment ${time(environmentTime)}, prepare ${time(prepareTime)})`));
7875
7876
  logger.log();
7876
7877
  }
7877
- async printErrorsSummary(files) {
7878
+ async printErrorsSummary(files, errors) {
7878
7879
  const logger = this.ctx.logger;
7879
7880
  const suites = getSuites(files);
7880
7881
  const tests = getTests(files);
@@ -7900,6 +7901,10 @@ ${log.content}
7900
7901
  logger.error();
7901
7902
  await this.printTaskErrors(failedTests, errorDivider);
7902
7903
  }
7904
+ if (errors.length) {
7905
+ await logger.printUnhandledErrors(errors);
7906
+ logger.error();
7907
+ }
7903
7908
  return tests;
7904
7909
  }
7905
7910
  async reportBenchmarkSummary(files) {
@@ -7973,9 +7978,9 @@ class BasicReporter extends BaseReporter {
7973
7978
  super(...arguments);
7974
7979
  this.isTTY = false;
7975
7980
  }
7976
- reportSummary(files) {
7981
+ reportSummary(files, errors) {
7977
7982
  this.ctx.logger.log();
7978
- return super.reportSummary(files);
7983
+ return super.reportSummary(files, errors);
7979
7984
  }
7980
7985
  }
7981
7986
 
@@ -9009,7 +9014,7 @@ class DefaultReporter extends BaseReporter {
9009
9014
  const files = this.ctx.state.getFiles(this.watchFilters);
9010
9015
  createListRenderer(files, this.rendererOptions).stop();
9011
9016
  this.ctx.logger.log();
9012
- await super.reportSummary(files);
9017
+ await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
9013
9018
  super.onWatcherStart();
9014
9019
  }
9015
9020
  onCollected() {
@@ -9904,7 +9909,7 @@ class TableReporter extends BaseReporter {
9904
9909
  const files = this.ctx.state.getFiles(this.watchFilters);
9905
9910
  createTableRenderer(files, this.rendererOptions).stop();
9906
9911
  this.ctx.logger.log();
9907
- await super.reportSummary(files);
9912
+ await super.reportSummary(files, this.ctx.state.getUnhandledErrors());
9908
9913
  super.onWatcherStart();
9909
9914
  }
9910
9915
  onCollected() {
@@ -11160,7 +11165,7 @@ createLogUpdate(process$1.stdout);
11160
11165
 
11161
11166
  createLogUpdate(process$1.stderr);
11162
11167
 
11163
- var version = "0.31.2";
11168
+ var version = "0.31.4";
11164
11169
 
11165
11170
  const comma = ','.charCodeAt(0);
11166
11171
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@@ -12370,9 +12375,12 @@ As a temporary workaround you can try to inline the package by updating your con
12370
12375
  ` + c.gray(c.dim("// vitest.config.js")) + "\n" + c.green(`export default {
12371
12376
  test: {
12372
12377
  deps: {
12373
- inline: [
12374
- ${c.yellow(c.bold(`"${name}"`))}
12375
- ]
12378
+ experimentalOptimizer: {
12379
+ enabled: true,
12380
+ include: [
12381
+ ${c.yellow(c.bold(`"${name}"`))}
12382
+ ]
12383
+ }
12376
12384
  }
12377
12385
  }
12378
12386
  }
@@ -13062,7 +13070,7 @@ function WorkspaceVitestPlugin(project, options) {
13062
13070
  },
13063
13071
  // TODO: refactor so we don't have the same code here and in plugins/index.ts
13064
13072
  config(viteConfig) {
13065
- var _a, _b, _c;
13073
+ var _a, _b, _c, _d, _e, _f, _g;
13066
13074
  if (viteConfig.define) {
13067
13075
  delete viteConfig.define["import.meta.vitest"];
13068
13076
  delete viteConfig.define["process.env"];
@@ -13140,6 +13148,33 @@ function WorkspaceVitestPlugin(project, options) {
13140
13148
  };
13141
13149
  }
13142
13150
  }
13151
+ const optimizeConfig = {};
13152
+ const optimizer = (_d = testConfig.deps) == null ? void 0 : _d.experimentalOptimizer;
13153
+ const [major, minor] = version$2.split(".").map(Number);
13154
+ const allowed = major >= 5 || major === 4 && minor >= 3;
13155
+ if (!allowed && (optimizer == null ? void 0 : optimizer.enabled) === true)
13156
+ console.warn(`Vitest: "deps.experimentalOptimizer" is only available in Vite >= 4.3.0, current Vite version: ${version$2}`);
13157
+ if (!allowed || (optimizer == null ? void 0 : optimizer.enabled) !== true) {
13158
+ optimizeConfig.cacheDir = void 0;
13159
+ optimizeConfig.optimizeDeps = {
13160
+ // experimental in Vite >2.9.2, entries remains to help with older versions
13161
+ disabled: true,
13162
+ entries: []
13163
+ };
13164
+ } else {
13165
+ const cacheDir = testConfig.cache !== false ? (_e = testConfig.cache) == null ? void 0 : _e.dir : null;
13166
+ optimizeConfig.cacheDir = cacheDir ?? "node_modules/.vitest";
13167
+ optimizeConfig.optimizeDeps = {
13168
+ ...viteConfig.optimizeDeps,
13169
+ ...optimizer,
13170
+ noDiscovery: true,
13171
+ disabled: false,
13172
+ entries: [],
13173
+ exclude: ["vitest", ...builtinModules, ...optimizer.exclude || ((_f = viteConfig.optimizeDeps) == null ? void 0 : _f.exclude) || []],
13174
+ include: (optimizer.include || ((_g = viteConfig.optimizeDeps) == null ? void 0 : _g.include) || []).filter((n) => n !== "vitest")
13175
+ };
13176
+ }
13177
+ Object.assign(config, optimizeConfig);
13143
13178
  return config;
13144
13179
  },
13145
13180
  async configureServer(server) {
@@ -14016,7 +14051,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14016
14051
  this.meta.watchMode = false;
14017
14052
  },
14018
14053
  async config(viteConfig) {
14019
- var _a, _b, _c, _d;
14054
+ var _a, _b, _c, _d, _e, _f, _g, _h;
14020
14055
  if (options.watch) {
14021
14056
  options = deepMerge({}, userConfig);
14022
14057
  }
@@ -14096,12 +14131,31 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
14096
14131
  }
14097
14132
  }
14098
14133
  const optimizeConfig = {};
14099
- optimizeConfig.cacheDir = void 0;
14100
- optimizeConfig.optimizeDeps = {
14101
- // experimental in Vite >2.9.2, entries remains to help with older versions
14102
- disabled: true,
14103
- entries: []
14104
- };
14134
+ const optimizer = (_e = preOptions.deps) == null ? void 0 : _e.experimentalOptimizer;
14135
+ const [major, minor] = version$2.split(".").map(Number);
14136
+ const allowed = major >= 5 || major === 4 && minor >= 3;
14137
+ if (!allowed && (optimizer == null ? void 0 : optimizer.enabled) === true)
14138
+ console.warn(`Vitest: "deps.experimentalOptimizer" is only available in Vite >= 4.3.0, current Vite version: ${version$2}`);
14139
+ if (!allowed || (optimizer == null ? void 0 : optimizer.enabled) !== true) {
14140
+ optimizeConfig.cacheDir = void 0;
14141
+ optimizeConfig.optimizeDeps = {
14142
+ // experimental in Vite >2.9.2, entries remains to help with older versions
14143
+ disabled: true,
14144
+ entries: []
14145
+ };
14146
+ } else {
14147
+ const cacheDir = preOptions.cache !== false ? (_f = preOptions.cache) == null ? void 0 : _f.dir : null;
14148
+ optimizeConfig.cacheDir = cacheDir ?? "node_modules/.vitest";
14149
+ optimizeConfig.optimizeDeps = {
14150
+ ...viteConfig.optimizeDeps,
14151
+ ...optimizer,
14152
+ noDiscovery: true,
14153
+ disabled: false,
14154
+ entries: [],
14155
+ exclude: ["vitest", ...builtinModules, ...optimizer.exclude || ((_g = viteConfig.optimizeDeps) == null ? void 0 : _g.exclude) || []],
14156
+ include: (optimizer.include || ((_h = viteConfig.optimizeDeps) == null ? void 0 : _h.include) || []).filter((n) => n !== "vitest")
14157
+ };
14158
+ }
14105
14159
  Object.assign(config, optimizeConfig);
14106
14160
  return config;
14107
14161
  },
@@ -1,5 +1,5 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.c6384282.js';
2
+ import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.23b98fa1.js';
3
3
  import { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
4
4
  import * as chai from 'chai';
5
5
  import { assert, should } from 'chai';
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
10
10
  globalSetup = true;
11
11
  setSafeTimers();
12
12
  if (config.globals)
13
- (await import('./chunk-integrations-globals.51b8ecab.js')).registerApiGlobally();
13
+ (await import('./chunk-integrations-globals.6a234998.js')).registerApiGlobally();
14
14
  }
15
15
  function setupDefines(defines) {
16
16
  for (const key in defines)
@@ -4,7 +4,7 @@ import '@vitest/utils';
4
4
  function hasFailedSnapshot(suite) {
5
5
  return getTests(suite).some((s) => {
6
6
  var _a, _b;
7
- return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => e && e.message && e.message.match(/Snapshot .* mismatched/));
7
+ return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/));
8
8
  });
9
9
  }
10
10
  function getFullName(task, separator = " > ") {
@@ -7,7 +7,7 @@ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
7
7
  import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
8
8
  import { SnapshotClient, stripSnapshotIndentation, addSerializer } from '@vitest/snapshot';
9
9
  import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global.6795f91f.js';
10
- import { g as getFullName } from './vendor-tasks.042d6084.js';
10
+ import { g as getFullName } from './vendor-tasks.f9d75aed.js';
11
11
  import require$$0 from 'util';
12
12
  import { spyOn, fn, isMockFunction, spies } from '@vitest/spy';
13
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.31.2",
4
+ "version": "0.31.4",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -148,12 +148,12 @@
148
148
  "tinypool": "^0.5.0",
149
149
  "vite": "^3.0.0 || ^4.0.0",
150
150
  "why-is-node-running": "^2.2.2",
151
- "@vitest/runner": "0.31.2",
152
- "vite-node": "0.31.2",
153
- "@vitest/expect": "0.31.2",
154
- "@vitest/spy": "0.31.2",
155
- "@vitest/utils": "0.31.2",
156
- "@vitest/snapshot": "0.31.2"
151
+ "@vitest/runner": "0.31.4",
152
+ "@vitest/expect": "0.31.4",
153
+ "@vitest/snapshot": "0.31.4",
154
+ "@vitest/spy": "0.31.4",
155
+ "vite-node": "0.31.4",
156
+ "@vitest/utils": "0.31.4"
157
157
  },
158
158
  "devDependencies": {
159
159
  "@ampproject/remapping": "^2.2.1",