vitest 0.25.3 → 0.25.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 +3 -3
- package/dist/browser.js +10 -9
- package/dist/{chunk-api-setup.c9f38753.js → chunk-api-setup.1c8923c4.js} +4 -2
- package/dist/{chunk-integrations-globals.1e636d22.js → chunk-integrations-globals.789c69e2.js} +7 -7
- package/dist/{chunk-runtime-chain.f993b1dc.js → chunk-runtime-chain.315721df.js} +8 -7
- package/dist/{chunk-runtime-error.6287172c.js → chunk-runtime-error.95c286d7.js} +2 -2
- package/dist/{chunk-runtime-mocker.c4d85347.js → chunk-runtime-mocker.cdc0ec57.js} +34 -18
- package/dist/{chunk-runtime-rpc.1e7530d3.js → chunk-runtime-rpc.b368762d.js} +2 -2
- package/dist/chunk-runtime-setup.80b27439.js +659 -0
- package/dist/{chunk-runtime-test-state.de4d6ff8.js → chunk-runtime-test-state.7c288e2d.js} +8 -6
- package/dist/{chunk-typecheck-constants.4891f22f.js → chunk-typecheck-constants.ed987901.js} +12 -2
- package/dist/{chunk-utils-source-map.c6dfbbc1.js → chunk-utils-source-map.29ff1088.js} +3 -1
- package/dist/{chunk-utils-timers.06f993db.js → chunk-utils-timers.b81cda77.js} +2 -0
- package/dist/{chunk-vite-node-externalize.c57d0ad1.js → chunk-vite-node-externalize.ddcbafa3.js} +55 -26
- package/dist/{chunk-vite-node-client.58cb6bfa.js → chunk-vite-node-source-map.61c5ea66.js} +37 -11
- package/dist/{chunk-vite-node-utils.f6d73fbe.js → chunk-vite-node-utils.abe05c5c.js} +1 -14
- package/dist/cli.js +8 -7
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +2 -1
- package/dist/entry.js +9 -8
- package/dist/environments.d.ts +1 -1
- package/dist/{index-9f5bc072.d.ts → index-81973d31.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/loader.js +2 -2
- package/dist/node.d.ts +5 -4
- package/dist/node.js +9 -8
- package/dist/suite.js +6 -6
- package/dist/{types-de0e0997.d.ts → types-1cf24598.d.ts} +70 -24
- package/dist/{chunk-runtime-setup.667a5719.js → vendor-source-map-support.1ce17397.js} +1 -657
- package/dist/worker.js +9 -7
- package/package.json +4 -4
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
2
|
-
import { b as ResolvedConfig } from './types-
|
|
3
|
-
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, 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-
|
|
1
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-81973d31.js';
|
|
2
|
+
import { b as ResolvedConfig } from './types-1cf24598.js';
|
|
3
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, 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-1cf24598.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
import { e as dist } from './chunk-runtime-test-state.
|
|
3
|
-
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.
|
|
4
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.315721df.js';
|
|
2
|
+
import { e as dist } from './chunk-runtime-test-state.7c288e2d.js';
|
|
3
|
+
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.7c288e2d.js';
|
|
4
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.80b27439.js';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
export { chai };
|
|
7
7
|
export { assert, should } from 'chai';
|
|
8
8
|
import 'util';
|
|
9
|
-
import './chunk-typecheck-constants.
|
|
9
|
+
import './chunk-typecheck-constants.ed987901.js';
|
|
10
10
|
import 'path';
|
|
11
11
|
import './chunk-utils-env.03f840f2.js';
|
|
12
12
|
import 'tty';
|
|
13
13
|
import 'url';
|
|
14
14
|
import 'local-pkg';
|
|
15
15
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
16
|
-
import './chunk-runtime-rpc.
|
|
17
|
-
import './chunk-utils-timers.
|
|
16
|
+
import './chunk-runtime-rpc.b368762d.js';
|
|
17
|
+
import './chunk-utils-timers.b81cda77.js';
|
|
18
18
|
import 'fs';
|
|
19
|
-
import './chunk-utils-source-map.
|
|
19
|
+
import './chunk-utils-source-map.29ff1088.js';
|
|
20
20
|
import './spy.js';
|
|
21
21
|
import 'tinyspy';
|
|
22
22
|
import 'perf_hooks';
|
|
23
23
|
import './chunk-integrations-coverage.befed097.js';
|
|
24
|
-
import './chunk-runtime-error.
|
|
24
|
+
import './chunk-runtime-error.95c286d7.js';
|
|
25
|
+
import './vendor-source-map-support.1ce17397.js';
|
|
25
26
|
import 'source-map';
|
|
26
27
|
import './chunk-env-node.67948209.js';
|
|
27
28
|
import 'console';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-source-map.61c5ea66.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -12,12 +12,14 @@ import url from 'url';
|
|
|
12
12
|
import { A as API_PATH } from './chunk-utils-env.03f840f2.js';
|
|
13
13
|
import 'module';
|
|
14
14
|
import 'vm';
|
|
15
|
-
import './chunk-vite-node-utils.
|
|
15
|
+
import './chunk-vite-node-utils.abe05c5c.js';
|
|
16
16
|
import 'acorn';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
19
19
|
import 'util';
|
|
20
20
|
import 'debug';
|
|
21
|
+
import './vendor-source-map-support.1ce17397.js';
|
|
22
|
+
import 'source-map';
|
|
21
23
|
import 'tty';
|
|
22
24
|
|
|
23
25
|
/*! (c) 2020 Andrea Giammarchi */
|
package/dist/{chunk-integrations-globals.1e636d22.js → chunk-integrations-globals.789c69e2.js}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { m as globalApis } from './chunk-utils-env.03f840f2.js';
|
|
2
|
-
import { i as index } from './chunk-runtime-test-state.
|
|
2
|
+
import { i as index } from './chunk-runtime-test-state.7c288e2d.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.
|
|
6
|
+
import './chunk-runtime-chain.315721df.js';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-typecheck-constants.4891f22f.js';
|
|
9
|
-
import 'local-pkg';
|
|
10
8
|
import 'chai';
|
|
9
|
+
import './chunk-typecheck-constants.ed987901.js';
|
|
10
|
+
import 'local-pkg';
|
|
11
11
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
13
|
-
import './chunk-utils-timers.
|
|
12
|
+
import './chunk-runtime-rpc.b368762d.js';
|
|
13
|
+
import './chunk-utils-timers.b81cda77.js';
|
|
14
14
|
import 'fs';
|
|
15
|
-
import './chunk-utils-source-map.
|
|
15
|
+
import './chunk-utils-source-map.29ff1088.js';
|
|
16
16
|
import './spy.js';
|
|
17
17
|
import 'tinyspy';
|
|
18
18
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
|
-
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-typecheck-constants.4891f22f.js';
|
|
3
2
|
import * as chai$2 from 'chai';
|
|
4
3
|
import { expect, AssertionError, util } from 'chai';
|
|
4
|
+
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, o as objectAttr, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-typecheck-constants.ed987901.js';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.b368762d.js';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
8
|
import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.03f840f2.js';
|
|
9
|
-
import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.
|
|
10
|
-
import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.
|
|
9
|
+
import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.b81cda77.js';
|
|
10
|
+
import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.29ff1088.js';
|
|
11
11
|
import { isMockFunction } from './spy.js';
|
|
12
12
|
|
|
13
13
|
function createChainable(keys, fn) {
|
|
@@ -2409,9 +2409,10 @@ function formatTitle(template, items, idx) {
|
|
|
2409
2409
|
const count = template.split("%").length - 1;
|
|
2410
2410
|
let formatted = util$1.format(template, ...items.slice(0, count));
|
|
2411
2411
|
if (isObject(items[0])) {
|
|
2412
|
-
formatted = formatted.replace(
|
|
2413
|
-
|
|
2414
|
-
|
|
2412
|
+
formatted = formatted.replace(
|
|
2413
|
+
/\$([$\w_.]+)/g,
|
|
2414
|
+
(_, key) => util.objDisplay(objectAttr(items[0], key))
|
|
2415
|
+
);
|
|
2415
2416
|
}
|
|
2416
2417
|
return formatted;
|
|
2417
2418
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
2
|
import { util } from 'chai';
|
|
3
|
-
import { a as stringify } from './chunk-utils-timers.
|
|
4
|
-
import {
|
|
3
|
+
import { a as stringify } from './chunk-utils-timers.b81cda77.js';
|
|
4
|
+
import { w as deepClone, x as getType } from './chunk-typecheck-constants.ed987901.js';
|
|
5
5
|
|
|
6
6
|
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
7
7
|
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-source-map.61c5ea66.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { g as getWorkerState,
|
|
3
|
+
import { g as getWorkerState, J as mergeSlashes, s as slash, x as getType, K as getAllMockableProperties } from './chunk-typecheck-constants.ed987901.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin
|
|
6
|
-
import { d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
5
|
+
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin } from './chunk-vite-node-utils.abe05c5c.js';
|
|
6
|
+
import { p as picocolors, d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
7
7
|
|
|
8
8
|
class RefTracker {
|
|
9
9
|
constructor() {
|
|
@@ -31,6 +31,7 @@ const _VitestMocker = class {
|
|
|
31
31
|
this.options = options;
|
|
32
32
|
this.moduleCache = moduleCache;
|
|
33
33
|
this.request = request;
|
|
34
|
+
this.resolveCache = /* @__PURE__ */ new Map();
|
|
34
35
|
}
|
|
35
36
|
get root() {
|
|
36
37
|
return this.options.root;
|
|
@@ -67,12 +68,12 @@ const _VitestMocker = class {
|
|
|
67
68
|
if (mock.type === "unmock")
|
|
68
69
|
this.unmockPath(path);
|
|
69
70
|
if (mock.type === "mock")
|
|
70
|
-
this.mockPath(path, external, mock.factory);
|
|
71
|
+
this.mockPath(mock.id, path, external, mock.factory);
|
|
71
72
|
}));
|
|
72
73
|
_VitestMocker.pendingIds = [];
|
|
73
74
|
}
|
|
74
75
|
async callFunctionMock(dep, mock) {
|
|
75
|
-
var _a;
|
|
76
|
+
var _a, _b;
|
|
76
77
|
const cached = (_a = this.moduleCache.get(dep)) == null ? void 0 : _a.exports;
|
|
77
78
|
if (cached)
|
|
78
79
|
return cached;
|
|
@@ -88,21 +89,34 @@ const _VitestMocker = class {
|
|
|
88
89
|
}
|
|
89
90
|
if (exports === null || typeof exports !== "object")
|
|
90
91
|
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?');
|
|
91
|
-
this.moduleCache.set(dep, { exports });
|
|
92
92
|
const filepath = dep.slice("mock:".length);
|
|
93
|
-
const
|
|
93
|
+
const mockpath = ((_b = this.resolveCache.get(this.getSuiteFilepath())) == null ? void 0 : _b[filepath]) || filepath;
|
|
94
|
+
const moduleExports = new Proxy(exports, {
|
|
94
95
|
get(target, prop) {
|
|
95
96
|
const val = target[prop];
|
|
96
97
|
if (prop === "then") {
|
|
97
98
|
if (target instanceof Promise)
|
|
98
99
|
return target.then.bind(target);
|
|
99
100
|
} else if (!(prop in target)) {
|
|
100
|
-
throw new Error(
|
|
101
|
+
throw new Error(
|
|
102
|
+
`[vitest] No "${String(prop)}" export is defined on the "${mockpath}" mock. Did you forget to return it from "vi.mock"?
|
|
103
|
+
If you need to partially mock a module, you can use "vi.importActual" inside:
|
|
104
|
+
|
|
105
|
+
${picocolors.exports.green(`vi.mock("${mockpath}", async () => {
|
|
106
|
+
const actual = await vi.importActual("${mockpath}")
|
|
107
|
+
return {
|
|
108
|
+
...actual,
|
|
109
|
+
// your mock
|
|
110
|
+
},
|
|
111
|
+
})`)}
|
|
112
|
+
`
|
|
113
|
+
);
|
|
101
114
|
}
|
|
102
115
|
return val;
|
|
103
116
|
}
|
|
104
|
-
};
|
|
105
|
-
|
|
117
|
+
});
|
|
118
|
+
this.moduleCache.set(dep, { exports: moduleExports });
|
|
119
|
+
return moduleExports;
|
|
106
120
|
}
|
|
107
121
|
getMockPath(dep) {
|
|
108
122
|
return `mock:${dep}`;
|
|
@@ -139,7 +153,7 @@ const _VitestMocker = class {
|
|
|
139
153
|
const fullPath = resolve(dir, "__mocks__", baseId);
|
|
140
154
|
return existsSync(fullPath) ? fullPath : null;
|
|
141
155
|
}
|
|
142
|
-
mockObject(object) {
|
|
156
|
+
mockObject(object, mockExports = {}) {
|
|
143
157
|
if (!_VitestMocker.spyModule) {
|
|
144
158
|
throw new Error(
|
|
145
159
|
"Error: Spy module is not defined. This is likely an internal bug in Vitest. Please report it to https://github.com/vitest-dev/vitest/issues"
|
|
@@ -195,7 +209,7 @@ const _VitestMocker = class {
|
|
|
195
209
|
mockPropertiesOf(value, newContainer[property]);
|
|
196
210
|
}
|
|
197
211
|
};
|
|
198
|
-
const mockedObject =
|
|
212
|
+
const mockedObject = mockExports;
|
|
199
213
|
mockPropertiesOf(object, mockedObject);
|
|
200
214
|
for (const finalizer of finalizers)
|
|
201
215
|
finalizer();
|
|
@@ -211,12 +225,15 @@ const _VitestMocker = class {
|
|
|
211
225
|
if (this.moduleCache.get(mockId))
|
|
212
226
|
this.moduleCache.delete(mockId);
|
|
213
227
|
}
|
|
214
|
-
mockPath(path, external, factory) {
|
|
228
|
+
mockPath(originalId, path, external, factory) {
|
|
215
229
|
const suitefile = this.getSuiteFilepath();
|
|
216
230
|
const id = this.normalizePath(path);
|
|
217
231
|
const mocks = this.mockMap.get(suitefile) || {};
|
|
232
|
+
const resolves = this.resolveCache.get(suitefile) || {};
|
|
218
233
|
mocks[id] = factory || this.resolveMockPath(path, external);
|
|
234
|
+
resolves[id] = originalId;
|
|
219
235
|
this.mockMap.set(suitefile, mocks);
|
|
236
|
+
this.resolveCache.set(suitefile, resolves);
|
|
220
237
|
}
|
|
221
238
|
async importActual(id, importer) {
|
|
222
239
|
const { path, external } = await this.resolvePath(id, importer);
|
|
@@ -246,7 +263,6 @@ const _VitestMocker = class {
|
|
|
246
263
|
_VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.js"))}`);
|
|
247
264
|
}
|
|
248
265
|
async requestWithMock(dep) {
|
|
249
|
-
var _a;
|
|
250
266
|
await Promise.all([
|
|
251
267
|
this.ensureSpy(),
|
|
252
268
|
this.resolveMocks()
|
|
@@ -259,10 +275,10 @@ const _VitestMocker = class {
|
|
|
259
275
|
const cache = this.moduleCache.get(mockPath);
|
|
260
276
|
if (cache == null ? void 0 : cache.exports)
|
|
261
277
|
return cache.exports;
|
|
262
|
-
const
|
|
263
|
-
const mod = ((_a = this.moduleCache.get(cacheKey)) == null ? void 0 : _a.exports) || await this.request(dep);
|
|
264
|
-
const exports = this.mockObject(mod);
|
|
278
|
+
const exports = {};
|
|
265
279
|
this.moduleCache.set(mockPath, { exports });
|
|
280
|
+
const mod = await this.request(dep);
|
|
281
|
+
this.mockObject(mod, exports);
|
|
266
282
|
return exports;
|
|
267
283
|
}
|
|
268
284
|
if (typeof mock === "function" && !callstack.includes(mockPath)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getWorkerState } from './chunk-typecheck-constants.
|
|
2
|
-
import { s as safeSetTimeout } from './chunk-utils-timers.
|
|
1
|
+
import { g as getWorkerState } from './chunk-typecheck-constants.ed987901.js';
|
|
2
|
+
import { s as safeSetTimeout } from './chunk-utils-timers.b81cda77.js';
|
|
3
3
|
|
|
4
4
|
const safeRandom = Math.random;
|
|
5
5
|
function withSafeTimers(fn) {
|