vitest 0.21.0 → 0.21.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 (34) hide show
  1. package/LICENSE.md +29 -0
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.mjs +7 -7
  4. package/dist/{chunk-api-setup.89eb0e7a.mjs → chunk-api-setup.7a6ba7fb.mjs} +5 -5
  5. package/dist/{chunk-constants.9da1ef26.mjs → chunk-constants.26dc9f85.mjs} +1 -1
  6. package/dist/{chunk-defaults.8390340d.mjs → chunk-defaults.02abff90.mjs} +1 -1
  7. package/dist/{chunk-integrations-globals.a798d352.mjs → chunk-integrations-globals.44a8f047.mjs} +6 -6
  8. package/dist/{chunk-mock-date.ea3b3121.mjs → chunk-mock-date.bc81a3ac.mjs} +1 -1
  9. package/dist/{chunk-node-git.e0dc0a7e.mjs → chunk-node-git.c2be9c49.mjs} +1 -1
  10. package/dist/{chunk-runtime-chain.44b4224d.mjs → chunk-runtime-chain.98d42d89.mjs} +3 -3
  11. package/dist/{chunk-runtime-error.95e53764.mjs → chunk-runtime-error.87a2b5a2.mjs} +11 -11
  12. package/dist/{chunk-runtime-hooks.291644ec.mjs → chunk-runtime-hooks.453f8858.mjs} +3 -3
  13. package/dist/{chunk-runtime-mocker.6190d6a3.mjs → chunk-runtime-mocker.23b62bfa.mjs} +19 -5
  14. package/dist/{chunk-runtime-rpc.fc50dcc0.mjs → chunk-runtime-rpc.b50ab560.mjs} +1 -1
  15. package/dist/{chunk-utils-source-map.d307e4ea.mjs → chunk-utils-source-map.94107ee8.mjs} +1 -1
  16. package/dist/{chunk-vite-node-client.b59ba135.mjs → chunk-vite-node-client.fdd9592c.mjs} +7 -3
  17. package/dist/{chunk-vite-node-debug.dbce2e1f.mjs → chunk-vite-node-debug.09afb76f.mjs} +1 -1
  18. package/dist/{chunk-vite-node-externalize.80bed9b3.mjs → chunk-vite-node-externalize.27aee038.mjs} +14 -14
  19. package/dist/chunk-vite-node-utils.f34df9d3.mjs +6887 -0
  20. package/dist/cli.mjs +8 -8
  21. package/dist/config.d.ts +1 -1
  22. package/dist/entry.mjs +7 -7
  23. package/dist/{global-644546f7.d.ts → global-60f880c6.d.ts} +9 -7
  24. package/dist/{index-3f764034.d.ts → index-4a906fa4.d.ts} +3 -3
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.mjs +5 -5
  27. package/dist/loader.mjs +3 -3
  28. package/dist/node.d.ts +2 -2
  29. package/dist/node.mjs +9 -9
  30. package/dist/suite.mjs +4 -4
  31. package/dist/{vendor-index.de788b6a.mjs → vendor-index.ae96af6e.mjs} +14 -14
  32. package/dist/worker.mjs +6 -6
  33. package/package.json +6 -6
  34. package/dist/chunk-vite-node-utils.96438e82.mjs +0 -1114
package/LICENSE.md CHANGED
@@ -197,6 +197,35 @@ Repository: https://github.com/sinonjs/fake-timers.git
197
197
 
198
198
  ---------------------------------------
199
199
 
200
+ ## acorn
201
+ License: MIT
202
+ By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
203
+ Repository: https://github.com/acornjs/acorn.git
204
+
205
+ > MIT License
206
+ >
207
+ > Copyright (C) 2012-2022 by various contributors (see AUTHORS)
208
+ >
209
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
210
+ > of this software and associated documentation files (the "Software"), to deal
211
+ > in the Software without restriction, including without limitation the rights
212
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
213
+ > copies of the Software, and to permit persons to whom the Software is
214
+ > furnished to do so, subject to the following conditions:
215
+ >
216
+ > The above copyright notice and this permission notice shall be included in
217
+ > all copies or substantial portions of the Software.
218
+ >
219
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
220
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
221
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
222
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
223
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
224
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
225
+ > THE SOFTWARE.
226
+
227
+ ---------------------------------------
228
+
200
229
  ## ansi-escapes
201
230
  License: MIT
202
231
  By: Sindre Sorhus
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject, R as ResolveIdFunction, S as SpyInstance, W as WorkerContext, x as WorkerGlobalState, w as WorkerRPC, h as afterAll, k as afterEach, g as beforeAll, j as beforeEach, m as createExpect, e as describe, l as expect, i as it, d as suite, t as test } from './index-3f764034.js';
2
- import { R as ResolvedConfig } from './global-644546f7.js';
3
- export { A as ApiConfig, C as ArgumentsType, z as Arrayable, y as Awaitable, B as BuiltinEnvironment, a0 as C8Options, O as Constructable, $ as CoverageReporter, K as DeepMerge, D as DoneCallback, W as Environment, E as EnvironmentOptions, Q as EnvironmentReturn, _ as ErrorWithDiff, a as File, l as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, G as MergeInsertions, P as ModuleCache, M as ModuleGraphData, L as MutableArray, N as Nullable, Z as ParsedStack, Y as Position, b as Reporter, a1 as ResolvedC8Options, R as ResolvedConfig, c as RunMode, p as RuntimeContext, r as SnapshotData, u as SnapshotMatchOptions, v as SnapshotResult, t as SnapshotStateOptions, x as SnapshotSummary, s as SnapshotUpdateState, S as Suite, k as SuiteAPI, n as SuiteCollector, o as SuiteFactory, m as SuiteHooks, h as Task, e as TaskBase, f as TaskResult, T as TaskResultPack, d as TaskState, g as Test, j as TestAPI, q as TestContext, i as TestFunction, w as UncheckedSnapshot, U as UserConfig, X as UserConsoleLog, V as Vitest } from './global-644546f7.js';
1
+ export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject, R as ResolveIdFunction, S as SpyInstance, W as WorkerContext, x as WorkerGlobalState, w as WorkerRPC, h as afterAll, k as afterEach, g as beforeAll, j as beforeEach, m as createExpect, e as describe, l as expect, i as it, d as suite, t as test } from './index-4a906fa4.js';
2
+ import { R as ResolvedConfig } from './global-60f880c6.js';
3
+ export { A as ApiConfig, C as ArgumentsType, z as Arrayable, y as Awaitable, B as BuiltinEnvironment, a0 as C8Options, O as Constructable, $ as CoverageReporter, K as DeepMerge, D as DoneCallback, W as Environment, E as EnvironmentOptions, Q as EnvironmentReturn, _ as ErrorWithDiff, a as File, l as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, G as MergeInsertions, P as ModuleCache, M as ModuleGraphData, L as MutableArray, N as Nullable, Z as ParsedStack, Y as Position, b as Reporter, a1 as ResolvedC8Options, R as ResolvedConfig, c as RunMode, p as RuntimeContext, r as SnapshotData, u as SnapshotMatchOptions, v as SnapshotResult, t as SnapshotStateOptions, x as SnapshotSummary, s as SnapshotUpdateState, S as Suite, k as SuiteAPI, n as SuiteCollector, o as SuiteFactory, m as SuiteHooks, h as Task, e as TaskBase, f as TaskResult, T as TaskResultPack, d as TaskState, g as Test, j as TestAPI, q as TestContext, i as TestFunction, w as UncheckedSnapshot, U as UserConfig, X as UserConsoleLog, V as Vitest } from './global-60f880c6.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
package/dist/browser.mjs CHANGED
@@ -1,22 +1,22 @@
1
- export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.44b4224d.mjs';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.291644ec.mjs';
3
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.95e53764.mjs';
1
+ export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.98d42d89.mjs';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.453f8858.mjs';
3
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.87a2b5a2.mjs';
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.ea3b3121.mjs';
8
+ import './chunk-mock-date.bc81a3ac.mjs';
9
9
  import 'path';
10
10
  import 'tty';
11
11
  import 'local-pkg';
12
12
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
13
- import './chunk-runtime-rpc.fc50dcc0.mjs';
13
+ import './chunk-runtime-rpc.b50ab560.mjs';
14
14
  import './chunk-utils-global.fa20c2f6.mjs';
15
15
  import './chunk-utils-timers.b48455ed.mjs';
16
16
  import 'fs';
17
- import './chunk-utils-source-map.d307e4ea.mjs';
17
+ import './chunk-utils-source-map.94107ee8.mjs';
18
18
  import './spy.mjs';
19
19
  import 'tinyspy';
20
- import './chunk-defaults.8390340d.mjs';
20
+ import './chunk-defaults.02abff90.mjs';
21
21
  import 'module';
22
22
  import 'url';
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-client.b59ba135.mjs';
2
+ import { c as createBirpc } from './chunk-vite-node-client.fdd9592c.mjs';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,15 +9,15 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import _url from 'url';
12
- import { A as API_PATH } from './chunk-constants.9da1ef26.mjs';
13
- import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
12
+ import { A as API_PATH } from './chunk-constants.26dc9f85.mjs';
13
+ import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.94107ee8.mjs';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-mock-date.ea3b3121.mjs';
16
+ import './chunk-mock-date.bc81a3ac.mjs';
17
17
  import 'path';
18
18
  import 'tty';
19
19
  import 'local-pkg';
20
- import './chunk-vite-node-utils.96438e82.mjs';
20
+ import './chunk-vite-node-utils.f34df9d3.mjs';
21
21
  import 'assert';
22
22
  import 'util';
23
23
  import 'debug';
@@ -1,5 +1,5 @@
1
1
  import _url from 'url';
2
- import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
2
+ import { y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
3
3
 
4
4
  const rootDir = resolve(_url.fileURLToPath(import.meta.url), "../../");
5
5
  const distDir = resolve(_url.fileURLToPath(import.meta.url), "../../dist");
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import _url from 'url';
4
- import { t as toArray, y as resolve } from './chunk-mock-date.ea3b3121.mjs';
4
+ import { t as toArray, y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
5
5
  import { importModule } from 'local-pkg';
6
6
 
7
7
  /*
@@ -1,19 +1,19 @@
1
- import { g as globalApis } from './chunk-constants.9da1ef26.mjs';
2
- import { i as index } from './chunk-runtime-hooks.291644ec.mjs';
1
+ import { g as globalApis } from './chunk-constants.26dc9f85.mjs';
2
+ import { i as index } from './chunk-runtime-hooks.453f8858.mjs';
3
3
  import 'url';
4
- import './chunk-mock-date.ea3b3121.mjs';
4
+ import './chunk-mock-date.bc81a3ac.mjs';
5
5
  import 'path';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
- import './chunk-runtime-chain.44b4224d.mjs';
8
+ import './chunk-runtime-chain.98d42d89.mjs';
9
9
  import 'util';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
- import './chunk-runtime-rpc.fc50dcc0.mjs';
12
+ import './chunk-runtime-rpc.b50ab560.mjs';
13
13
  import './chunk-utils-global.fa20c2f6.mjs';
14
14
  import './chunk-utils-timers.b48455ed.mjs';
15
15
  import 'fs';
16
- import './chunk-utils-source-map.d307e4ea.mjs';
16
+ import './chunk-utils-source-map.94107ee8.mjs';
17
17
  import './spy.mjs';
18
18
  import 'tinyspy';
19
19
 
@@ -500,7 +500,7 @@ async function ensurePackageInstalled(dependency, root) {
500
500
  `));
501
501
  if (!promptInstall)
502
502
  return false;
503
- const prompts = await import('./vendor-index.de788b6a.mjs').then(function (n) { return n.i; });
503
+ const prompts = await import('./vendor-index.ae96af6e.mjs').then(function (n) { return n.i; });
504
504
  const { install } = await prompts.prompt({
505
505
  type: "confirm",
506
506
  name: "install",
@@ -1,4 +1,4 @@
1
- import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
1
+ import { y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
2
2
  import { Buffer } from 'buffer';
3
3
  import path from 'path';
4
4
  import childProcess from 'child_process';
@@ -1,11 +1,11 @@
1
1
  import util$1 from 'util';
2
- import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.ea3b3121.mjs';
2
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.bc81a3ac.mjs';
3
3
  import * as chai$2 from 'chai';
4
4
  import { expect, AssertionError, util } from 'chai';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
6
- import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
6
+ import { r as rpc } from './chunk-runtime-rpc.b50ab560.mjs';
7
7
  import fs, { promises } from 'fs';
8
- import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.d307e4ea.mjs';
8
+ import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.94107ee8.mjs';
9
9
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
10
10
  import { isMockFunction } from './spy.mjs';
11
11
  import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
@@ -1,11 +1,11 @@
1
- import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.8390340d.mjs';
2
- import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.291644ec.mjs';
3
- import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.ea3b3121.mjs';
4
- import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.44b4224d.mjs';
5
- import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
1
+ import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.02abff90.mjs';
2
+ import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.453f8858.mjs';
3
+ import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.bc81a3ac.mjs';
4
+ import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.98d42d89.mjs';
5
+ import { r as rpc } from './chunk-runtime-rpc.b50ab560.mjs';
6
6
  import util$1 from 'util';
7
7
  import { util } from 'chai';
8
- import { s as stringify } from './chunk-utils-source-map.d307e4ea.mjs';
8
+ import { s as stringify } from './chunk-utils-source-map.94107ee8.mjs';
9
9
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
10
10
  import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.b48455ed.mjs';
11
11
 
@@ -131,7 +131,7 @@ async function setupGlobalEnv(config) {
131
131
  if (isNode)
132
132
  await setupConsoleLogSpy();
133
133
  if (config.globals)
134
- (await import('./chunk-integrations-globals.a798d352.mjs')).registerApiGlobally();
134
+ (await import('./chunk-integrations-globals.44a8f047.mjs')).registerApiGlobally();
135
135
  }
136
136
  function setupDefines(defines) {
137
137
  for (const key in defines)
@@ -442,7 +442,7 @@ async function sendTasksUpdate() {
442
442
  async function runTest(test) {
443
443
  var _a, _b;
444
444
  if (test.mode !== "run") {
445
- const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
445
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.98d42d89.mjs').then(function (n) { return n.p; });
446
446
  getSnapshotClient().skipTestSnapshots(test);
447
447
  return;
448
448
  }
@@ -458,7 +458,7 @@ async function runTest(test) {
458
458
  updateTask(test);
459
459
  clearModuleMocks();
460
460
  if (isNode) {
461
- const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
461
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.98d42d89.mjs').then(function (n) { return n.p; });
462
462
  await getSnapshotClient().setTest(test);
463
463
  }
464
464
  const workerState = getWorkerState();
@@ -511,7 +511,7 @@ async function runTest(test) {
511
511
  if (isBrowser && test.result.error)
512
512
  console.error(test.result.error.message, test.result.error.stackStr);
513
513
  if (isNode) {
514
- const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
514
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.98d42d89.mjs').then(function (n) { return n.p; });
515
515
  getSnapshotClient().clearTest();
516
516
  }
517
517
  test.result.duration = now() - start;
@@ -623,7 +623,7 @@ async function startTestsBrowser(paths, config) {
623
623
  async function startTestsNode(paths, config) {
624
624
  const files = await collectTests(paths, config);
625
625
  rpc().onCollected(files);
626
- const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
626
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.98d42d89.mjs').then(function (n) { return n.p; });
627
627
  getSnapshotClient().clear();
628
628
  await runFiles(files, config);
629
629
  takeCoverage();
@@ -1,7 +1,7 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.44b4224d.mjs';
2
- import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.ea3b3121.mjs';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.98d42d89.mjs';
2
+ import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.bc81a3ac.mjs';
3
3
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
4
- import { p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
4
+ import { p as parseStacktrace } from './chunk-utils-source-map.94107ee8.mjs';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
6
6
  import util from 'util';
7
7
  import { spyOn, fn, isMockFunction, spies } from './spy.mjs';
@@ -1,9 +1,9 @@
1
- import { V as ViteNodeRunner } from './chunk-vite-node-client.b59ba135.mjs';
1
+ import { V as ViteNodeRunner } from './chunk-vite-node-client.fdd9592c.mjs';
2
2
  import { normalizePath } from 'vite';
3
- import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as getAllMockableProperties } from './chunk-mock-date.ea3b3121.mjs';
3
+ import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as getAllMockableProperties } from './chunk-mock-date.bc81a3ac.mjs';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.96438e82.mjs';
6
- import { d as distDir } from './chunk-constants.9da1ef26.mjs';
5
+ import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.f34df9d3.mjs';
6
+ import { d as distDir } from './chunk-constants.26dc9f85.mjs';
7
7
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
8
8
 
9
9
  class RefTracker {
@@ -78,8 +78,22 @@ const _VitestMocker = class {
78
78
  if (cached)
79
79
  return cached;
80
80
  const exports = await mock();
81
+ if (exports === null || typeof exports !== "object")
82
+ throw new Error('[vitest] vi.mock(path: string, factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?');
81
83
  this.moduleCache.set(dep, { exports });
82
- return exports;
84
+ const exportHandler = {
85
+ get(target, prop) {
86
+ const val = target[prop];
87
+ if (prop === "then") {
88
+ if (target instanceof Promise)
89
+ return target.then.bind(target);
90
+ } else if (val === void 0) {
91
+ throw new Error(`[vitest] No "${prop}" export is defined on the "${dep}"`);
92
+ }
93
+ return val;
94
+ }
95
+ };
96
+ return new Proxy(exports, exportHandler);
83
97
  }
84
98
  getMockPath(dep) {
85
99
  return `mock:${dep}`;
@@ -1,4 +1,4 @@
1
- import './chunk-mock-date.ea3b3121.mjs';
1
+ import './chunk-mock-date.bc81a3ac.mjs';
2
2
  import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
3
3
  import { w as withSafeTimers } from './chunk-utils-timers.b48455ed.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { s as slash, f as notNullish, p as picocolors } from './chunk-mock-date.ea3b3121.mjs';
1
+ import { s as slash, f as notNullish, p as picocolors } from './chunk-mock-date.bc81a3ac.mjs';
2
2
 
3
3
  var build = {};
4
4
 
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module';
2
2
  import { pathToFileURL, fileURLToPath } from 'url';
3
3
  import vm from 'vm';
4
- import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.ea3b3121.mjs';
5
- import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.96438e82.mjs';
4
+ import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.bc81a3ac.mjs';
5
+ import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.f34df9d3.mjs';
6
6
  import createDebug from 'debug';
7
7
 
8
8
  const debugExecute = createDebug("vite-node:client:execute");
@@ -141,7 +141,11 @@ ${getStack()}`), 2e3);
141
141
  const url = pathToFileURL(fsPath).href;
142
142
  const meta = { url };
143
143
  const exports = /* @__PURE__ */ Object.create(null);
144
- exports[Symbol.toStringTag] = "Module";
144
+ Object.defineProperty(exports, Symbol.toStringTag, {
145
+ value: "Module",
146
+ enumerable: false,
147
+ configurable: false
148
+ });
145
149
  this.moduleCache.set(fsPath, { code: transformed, exports });
146
150
  const __filename = fileURLToPath(url);
147
151
  const moduleProxy = {
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises } from 'fs';
2
- import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.ea3b3121.mjs';
2
+ import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.bc81a3ac.mjs';
3
3
  import 'path';
4
4
  import 'tty';
5
5
  import 'local-pkg';
@@ -1,32 +1,32 @@
1
- import { y as resolve, j as join, z as basename, d as dirname, A as AggregateErrorPonyfill, p as picocolors, B as isAbsolute, C as relative, s as slash$2, l as isNode, o as relativePath, D as getTests, e as getFullName, x as hasFailed, E as hasFailedSnapshot, F as getSuites, v as shuffle, t as toArray$1, G as normalize, n as noop$1, H as deepMerge, I as toNamespacedPath, g as getCallLastIndex, f as notNullish, J as ensurePackageInstalled, K as stdout } from './chunk-mock-date.ea3b3121.mjs';
2
- import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.8390340d.mjs';
1
+ import { y as resolve, j as join, z as basename, d as dirname, A as AggregateErrorPonyfill, p as picocolors, B as isAbsolute, C as relative, s as slash$2, l as isNode, o as relativePath, D as getTests, e as getFullName, x as hasFailed, E as hasFailedSnapshot, F as getSuites, v as shuffle, t as toArray$1, G as normalize, n as noop$1, H as deepMerge, I as toNamespacedPath, g as getCallLastIndex, f as notNullish, J as ensurePackageInstalled, K as stdout } from './chunk-mock-date.bc81a3ac.mjs';
2
+ import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.02abff90.mjs';
3
3
  import { loadConfigFromFile, createServer, mergeConfig } from 'vite';
4
4
  import path$a from 'path';
5
5
  import _url, { fileURLToPath } from 'url';
6
6
  import process$1 from 'process';
7
7
  import fs$8, { promises, existsSync, readFileSync } from 'fs';
8
- import { d as distDir, r as rootDir, c as configFiles, a as defaultPort } from './chunk-constants.9da1ef26.mjs';
8
+ import { d as distDir, r as rootDir, c as configFiles, a as defaultPort } from './chunk-constants.26dc9f85.mjs';
9
9
  import require$$0, { cpus, hostname } from 'os';
10
10
  import util$2 from 'util';
11
11
  import require$$0$1 from 'stream';
12
12
  import require$$2 from 'events';
13
13
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
14
- import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.b59ba135.mjs';
14
+ import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.fdd9592c.mjs';
15
15
  import createDebug from 'debug';
16
- 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.96438e82.mjs';
16
+ 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.f34df9d3.mjs';
17
17
  import { MessageChannel } from 'worker_threads';
18
18
  import { Tinypool } from 'tinypool';
19
19
  import { performance } from 'perf_hooks';
20
- import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, e as stringWidth, h as ansiStyles, i as sliceAnsi, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.d307e4ea.mjs';
20
+ import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, e as stringWidth, h as ansiStyles, i as sliceAnsi, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.94107ee8.mjs';
21
21
  import { b as safeSetInterval, c as safeClearInterval, s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
22
22
  import { resolveModule } from 'local-pkg';
23
23
  import { createHash } from 'crypto';
24
24
  import { o as onetime, s as signalExit } from './vendor-index.61438b77.mjs';
25
25
  import MagicString from './chunk-magic-string.efe26975.mjs';
26
26
  import require$$0$2 from 'readline';
27
- import { p as prompts } from './vendor-index.de788b6a.mjs';
27
+ import { p as prompts } from './vendor-index.ae96af6e.mjs';
28
28
 
29
- var version$1 = "0.21.0";
29
+ var version$1 = "0.21.1";
30
30
 
31
31
  class EndError extends Error {
32
32
  constructor(value) {
@@ -6850,7 +6850,7 @@ class ViteNodeServer {
6850
6850
  }, options.debug ?? {});
6851
6851
  }
6852
6852
  if (options.debug)
6853
- import('./chunk-vite-node-debug.dbce2e1f.mjs').then((r) => this.debugger = new r.Debugger(server.config.root, options.debug));
6853
+ import('./chunk-vite-node-debug.09afb76f.mjs').then((r) => this.debugger = new r.Debugger(server.config.root, options.debug));
6854
6854
  }
6855
6855
  shouldExternalize(id) {
6856
6856
  return shouldExternalize(id, this.options.deps, this.externalizeCache);
@@ -7977,7 +7977,7 @@ function tapString(str) {
7977
7977
  class TapReporter {
7978
7978
  onInit(ctx) {
7979
7979
  this.ctx = ctx;
7980
- this.logger = new IndentedLogger(this.ctx.logger.log.bind(this.ctx));
7980
+ this.logger = new IndentedLogger(ctx.logger.log.bind(ctx.logger));
7981
7981
  }
7982
7982
  static getComment(task) {
7983
7983
  var _a;
@@ -9106,7 +9106,7 @@ createLogUpdate(process$1.stdout);
9106
9106
 
9107
9107
  createLogUpdate(process$1.stderr);
9108
9108
 
9109
- var version = "0.21.0";
9109
+ var version = "0.21.1";
9110
9110
 
9111
9111
  function fileFromParsedStack(stack) {
9112
9112
  var _a, _b;
@@ -9354,7 +9354,7 @@ class Logger {
9354
9354
  async printUnhandledErrors(errors) {
9355
9355
  const errorMessage = picocolors.exports.red(picocolors.exports.bold(`
9356
9356
  Vitest caught ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run. This might cause false positive tests.
9357
- Please, resolve all the errors to make sure your tests are not affected.`));
9357
+ Please, resolve all errors to make sure your tests are not affected.`));
9358
9358
  this.log(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Errors ")))));
9359
9359
  this.log(errorMessage);
9360
9360
  await Promise.all(errors.map(async (err) => {
@@ -9473,7 +9473,7 @@ class Vitest {
9473
9473
  }
9474
9474
  async filterTestsBySource(tests) {
9475
9475
  if (this.config.changed && !this.config.related) {
9476
- const { VitestGit } = await import('./chunk-node-git.e0dc0a7e.mjs');
9476
+ const { VitestGit } = await import('./chunk-node-git.c2be9c49.mjs');
9477
9477
  const vitestGit = new VitestGit(this.config.root);
9478
9478
  const related2 = await vitestGit.findChangedFiles({
9479
9479
  changedSince: this.config.changed
@@ -10062,7 +10062,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10062
10062
  await ctx.setServer(options, server);
10063
10063
  haveStarted = true;
10064
10064
  if (options.api && options.watch)
10065
- (await import('./chunk-api-setup.89eb0e7a.mjs')).setup(ctx);
10065
+ (await import('./chunk-api-setup.7a6ba7fb.mjs')).setup(ctx);
10066
10066
  } catch (err) {
10067
10067
  ctx.logger.printError(err, true);
10068
10068
  process.exit(1);