vitest 0.23.4 → 0.24.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.
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +24 -0
- package/dist/{chunk-api-setup.11cfd513.mjs → chunk-api-setup.33222ae9.js} +20 -20
- package/dist/{chunk-constants.71e8a211.mjs → chunk-constants.22640ce4.js} +0 -0
- package/dist/{chunk-env-node.ceb43f1c.mjs → chunk-env-node.700b7e95.js} +2 -1
- package/dist/{chunk-install-pkg.3aa3eae6.mjs → chunk-install-pkg.107b0cd7.js} +56 -20
- package/dist/{chunk-integrations-coverage.99c020eb.mjs → chunk-integrations-coverage.cca09977.js} +0 -0
- package/dist/chunk-integrations-globals.56d5b05b.js +25 -0
- package/dist/{chunk-magic-string.56b2b543.mjs → chunk-magic-string.ffe2b171.js} +60 -9
- package/dist/{chunk-mock-date.2917be60.mjs → chunk-mock-date.b1b404e8.js} +3 -3
- package/dist/{chunk-node-git.a44b4872.mjs → chunk-node-git.6d82fb34.js} +5 -5
- package/dist/{chunk-runtime-chain.0ab05798.mjs → chunk-runtime-chain.ca293c72.js} +16 -16
- package/dist/{chunk-runtime-error.f5506f40.mjs → chunk-runtime-error.c53389c7.js} +24 -16
- package/dist/{chunk-runtime-hooks.e4219ed5.mjs → chunk-runtime-hooks.1260cc21.js} +6 -6
- package/dist/{chunk-runtime-mocker.4bbb070f.mjs → chunk-runtime-mocker.623b90b6.js} +5 -5
- package/dist/{chunk-runtime-rpc.00a890d2.mjs → chunk-runtime-rpc.4f6f88e8.js} +2 -2
- package/dist/{chunk-utils-source-map.2be5aa48.mjs → chunk-utils-source-map.175ffa40.js} +10 -6
- package/dist/{chunk-utils-timers.b48455ed.mjs → chunk-utils-timers.ab764c0c.js} +0 -0
- package/dist/{chunk-vite-node-client.da0a17ff.mjs → chunk-vite-node-client.4dd32c96.js} +2 -2
- package/dist/{chunk-vite-node-debug.536c4c5b.mjs → chunk-vite-node-debug.77d9dcea.js} +1 -1
- package/dist/{chunk-vite-node-externalize.8d8032d0.mjs → chunk-vite-node-externalize.94f78ce5.js} +30 -23
- package/dist/{chunk-vite-node-utils.473cd0b2.mjs → chunk-vite-node-utils.c8c74a41.js} +39 -15
- package/dist/{cli-wrapper.mjs → cli-wrapper.js} +6 -6
- package/dist/{cli.mjs → cli.js} +14 -14
- package/dist/config.d.ts +1 -1
- package/dist/{config.mjs → config.js} +0 -0
- package/dist/entry.js +80 -0
- package/dist/environments.d.ts +1 -1
- package/dist/{environments.mjs → environments.js} +1 -1
- package/dist/{global-e98f203b.d.ts → global-732f9b14.d.ts} +2 -6
- package/dist/{index-6e18a03a.d.ts → index-40e0cb97.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/{index.mjs → index.js} +9 -9
- package/dist/{loader.mjs → loader.js} +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +37 -0
- package/dist/{spy.mjs → spy.js} +0 -0
- package/dist/suite.js +16 -0
- package/dist/{vendor-_commonjsHelpers.4da45ef5.mjs → vendor-_commonjsHelpers.addc3445.js} +0 -0
- package/dist/{vendor-index.fbec8a81.mjs → vendor-index.07e6fc5a.js} +2 -2
- package/dist/{vendor-index.0557b03a.mjs → vendor-index.534e612c.js} +1 -1
- package/dist/{vendor-index.29636037.mjs → vendor-index.8919d83a.js} +1 -1
- package/dist/{vendor-index.2ae8040a.mjs → vendor-index.95542d0a.js} +1 -1
- package/dist/{vendor-index.ae96af6e.mjs → vendor-index.9f20a9be.js} +0 -0
- package/dist/{vendor-index.9d9196cc.mjs → vendor-index.c902d578.js} +0 -0
- package/dist/{worker.mjs → worker.js} +8 -8
- package/index.cjs +0 -0
- package/index.d.cts +1 -0
- package/package.json +30 -22
- package/vitest.mjs +1 -1
- package/dist/browser.mjs +0 -24
- package/dist/chunk-integrations-globals.d8c90af9.mjs +0 -25
- package/dist/entry.mjs +0 -68
- package/dist/node.mjs +0 -37
- package/dist/suite.mjs +0 -16
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-
|
|
2
|
-
import { R as ResolvedConfig } from './global-
|
|
3
|
-
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-
|
|
1
|
+
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-40e0cb97.js';
|
|
2
|
+
import { R as ResolvedConfig } from './global-732f9b14.js';
|
|
3
|
+
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-732f9b14.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.ca293c72.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.1260cc21.js';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.c53389c7.js';
|
|
4
|
+
import * as chai from 'chai';
|
|
5
|
+
export { chai };
|
|
6
|
+
export { assert, should } from 'chai';
|
|
7
|
+
import 'util';
|
|
8
|
+
import './chunk-mock-date.b1b404e8.js';
|
|
9
|
+
import 'path';
|
|
10
|
+
import './chunk-constants.22640ce4.js';
|
|
11
|
+
import 'tty';
|
|
12
|
+
import 'url';
|
|
13
|
+
import 'local-pkg';
|
|
14
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
15
|
+
import './chunk-runtime-rpc.4f6f88e8.js';
|
|
16
|
+
import './chunk-utils-timers.ab764c0c.js';
|
|
17
|
+
import 'fs';
|
|
18
|
+
import './chunk-utils-source-map.175ffa40.js';
|
|
19
|
+
import './spy.js';
|
|
20
|
+
import 'tinyspy';
|
|
21
|
+
import 'perf_hooks';
|
|
22
|
+
import './chunk-integrations-coverage.cca09977.js';
|
|
23
|
+
import './chunk-env-node.700b7e95.js';
|
|
24
|
+
import 'console';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.4dd32c96.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,17 +9,17 @@ 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.
|
|
13
|
-
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.22640ce4.js';
|
|
13
|
+
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.175ffa40.js';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-vite-node-utils.
|
|
16
|
+
import './chunk-vite-node-utils.c8c74a41.js';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
19
19
|
import 'util';
|
|
20
20
|
import 'debug';
|
|
21
21
|
import 'tty';
|
|
22
|
-
import './chunk-mock-date.
|
|
22
|
+
import './chunk-mock-date.b1b404e8.js';
|
|
23
23
|
import 'local-pkg';
|
|
24
24
|
|
|
25
25
|
/*! (c) 2020 Andrea Giammarchi */
|
|
@@ -3182,20 +3182,20 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3182
3182
|
}
|
|
3183
3183
|
|
|
3184
3184
|
const isSecure = parsedUrl.protocol === 'wss:';
|
|
3185
|
-
const
|
|
3186
|
-
let
|
|
3185
|
+
const isIpcUrl = parsedUrl.protocol === 'ws+unix:';
|
|
3186
|
+
let invalidUrlMessage;
|
|
3187
3187
|
|
|
3188
|
-
if (parsedUrl.protocol !== 'ws:' && !isSecure && !
|
|
3189
|
-
|
|
3188
|
+
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
3189
|
+
invalidUrlMessage =
|
|
3190
3190
|
'The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"';
|
|
3191
|
-
} else if (
|
|
3192
|
-
|
|
3191
|
+
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
3192
|
+
invalidUrlMessage = "The URL's pathname is empty";
|
|
3193
3193
|
} else if (parsedUrl.hash) {
|
|
3194
|
-
|
|
3194
|
+
invalidUrlMessage = 'The URL contains a fragment identifier';
|
|
3195
3195
|
}
|
|
3196
3196
|
|
|
3197
|
-
if (
|
|
3198
|
-
const err = new SyntaxError(
|
|
3197
|
+
if (invalidUrlMessage) {
|
|
3198
|
+
const err = new SyntaxError(invalidUrlMessage);
|
|
3199
3199
|
|
|
3200
3200
|
if (websocket._redirects === 0) {
|
|
3201
3201
|
throw err;
|
|
@@ -3265,7 +3265,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3265
3265
|
opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
3266
3266
|
}
|
|
3267
3267
|
|
|
3268
|
-
if (
|
|
3268
|
+
if (isIpcUrl) {
|
|
3269
3269
|
const parts = opts.path.split(':');
|
|
3270
3270
|
|
|
3271
3271
|
opts.socketPath = parts[0];
|
|
@@ -3276,9 +3276,9 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3276
3276
|
|
|
3277
3277
|
if (opts.followRedirects) {
|
|
3278
3278
|
if (websocket._redirects === 0) {
|
|
3279
|
-
websocket.
|
|
3279
|
+
websocket._originalIpc = isIpcUrl;
|
|
3280
3280
|
websocket._originalSecure = isSecure;
|
|
3281
|
-
websocket._originalHostOrSocketPath =
|
|
3281
|
+
websocket._originalHostOrSocketPath = isIpcUrl
|
|
3282
3282
|
? opts.socketPath
|
|
3283
3283
|
: parsedUrl.host;
|
|
3284
3284
|
|
|
@@ -3296,11 +3296,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3296
3296
|
}
|
|
3297
3297
|
}
|
|
3298
3298
|
} else if (websocket.listenerCount('redirect') === 0) {
|
|
3299
|
-
const isSameHost =
|
|
3300
|
-
? websocket.
|
|
3299
|
+
const isSameHost = isIpcUrl
|
|
3300
|
+
? websocket._originalIpc
|
|
3301
3301
|
? opts.socketPath === websocket._originalHostOrSocketPath
|
|
3302
3302
|
: false
|
|
3303
|
-
: websocket.
|
|
3303
|
+
: websocket._originalIpc
|
|
3304
3304
|
? false
|
|
3305
3305
|
: parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
3306
3306
|
|
|
File without changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import path$2 from 'path';
|
|
2
1
|
import fs$2 from 'fs';
|
|
2
|
+
import path$2 from 'path';
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.
|
|
6
|
-
import { o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.95542d0a.js';
|
|
6
|
+
import { o as onetime$1 } from './vendor-index.c902d578.js';
|
|
7
7
|
import require$$0 from 'os';
|
|
8
|
-
import { s as signalExit } from './vendor-index.
|
|
9
|
-
import './vendor-_commonjsHelpers.
|
|
8
|
+
import { s as signalExit } from './vendor-index.8919d83a.js';
|
|
9
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
10
|
import 'buffer';
|
|
11
11
|
import 'stream';
|
|
12
12
|
import 'assert';
|
|
@@ -1611,32 +1611,68 @@ execa$1.exports.node = (scriptPath, args, options = {}) => {
|
|
|
1611
1611
|
};
|
|
1612
1612
|
|
|
1613
1613
|
// src/detect.ts
|
|
1614
|
+
var AGENTS = ["pnpm", "yarn", "npm", "pnpm@6", "yarn@berry", "bun"];
|
|
1614
1615
|
var LOCKS = {
|
|
1616
|
+
"bun.lockb": "bun",
|
|
1615
1617
|
"pnpm-lock.yaml": "pnpm",
|
|
1616
1618
|
"yarn.lock": "yarn",
|
|
1617
|
-
"package-lock.json": "npm"
|
|
1619
|
+
"package-lock.json": "npm",
|
|
1620
|
+
"npm-shrinkwrap.json": "npm"
|
|
1618
1621
|
};
|
|
1619
1622
|
async function detectPackageManager(cwd = process.cwd()) {
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1623
|
+
let agent = null;
|
|
1624
|
+
const lockPath = await findUp(Object.keys(LOCKS), { cwd });
|
|
1625
|
+
let packageJsonPath;
|
|
1626
|
+
if (lockPath)
|
|
1627
|
+
packageJsonPath = path$2.resolve(lockPath, "../package.json");
|
|
1628
|
+
else
|
|
1629
|
+
packageJsonPath = await findUp("package.json", { cwd });
|
|
1630
|
+
if (packageJsonPath && fs$2.existsSync(packageJsonPath)) {
|
|
1631
|
+
try {
|
|
1632
|
+
const pkg = JSON.parse(fs$2.readFileSync(packageJsonPath, "utf8"));
|
|
1633
|
+
if (typeof pkg.packageManager === "string") {
|
|
1634
|
+
const [name, version] = pkg.packageManager.split("@");
|
|
1635
|
+
if (name === "yarn" && parseInt(version) > 1)
|
|
1636
|
+
agent = "yarn@berry";
|
|
1637
|
+
else if (name === "pnpm" && parseInt(version) < 7)
|
|
1638
|
+
agent = "pnpm@6";
|
|
1639
|
+
else if (name in AGENTS)
|
|
1640
|
+
agent = name;
|
|
1641
|
+
else
|
|
1642
|
+
console.warn("[ni] Unknown packageManager:", pkg.packageManager);
|
|
1643
|
+
}
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
if (!agent && lockPath)
|
|
1648
|
+
agent = LOCKS[path$2.basename(lockPath)];
|
|
1622
1649
|
return agent;
|
|
1623
1650
|
}
|
|
1624
1651
|
async function installPackage(names, options = {}) {
|
|
1625
|
-
const
|
|
1652
|
+
const detectedAgent = options.packageManager || await detectPackageManager(options.cwd) || "npm";
|
|
1653
|
+
const [agent] = detectedAgent.split("@");
|
|
1626
1654
|
if (!Array.isArray(names))
|
|
1627
1655
|
names = [names];
|
|
1628
1656
|
const args = options.additionalArgs || [];
|
|
1629
|
-
if (options.preferOffline)
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1657
|
+
if (options.preferOffline) {
|
|
1658
|
+
if (detectedAgent === "yarn@berry")
|
|
1659
|
+
args.unshift("--cached");
|
|
1660
|
+
else
|
|
1661
|
+
args.unshift("--prefer-offline");
|
|
1662
|
+
}
|
|
1663
|
+
return execa$1.exports(
|
|
1664
|
+
agent,
|
|
1665
|
+
[
|
|
1666
|
+
agent === "yarn" ? "add" : "install",
|
|
1667
|
+
options.dev ? "-D" : "",
|
|
1668
|
+
...args,
|
|
1669
|
+
...names
|
|
1670
|
+
].filter(Boolean),
|
|
1671
|
+
{
|
|
1672
|
+
stdio: options.silent ? "ignore" : "inherit",
|
|
1673
|
+
cwd: options.cwd
|
|
1674
|
+
}
|
|
1675
|
+
);
|
|
1640
1676
|
}
|
|
1641
1677
|
|
|
1642
1678
|
export { detectPackageManager, installPackage };
|
package/dist/{chunk-integrations-coverage.99c020eb.mjs → chunk-integrations-coverage.cca09977.js}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { k as globalApis } from './chunk-constants.22640ce4.js';
|
|
2
|
+
import { i as index } from './chunk-runtime-hooks.1260cc21.js';
|
|
3
|
+
import 'tty';
|
|
4
|
+
import 'url';
|
|
5
|
+
import 'path';
|
|
6
|
+
import './chunk-runtime-chain.ca293c72.js';
|
|
7
|
+
import 'util';
|
|
8
|
+
import './chunk-mock-date.b1b404e8.js';
|
|
9
|
+
import 'local-pkg';
|
|
10
|
+
import 'chai';
|
|
11
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
+
import './chunk-runtime-rpc.4f6f88e8.js';
|
|
13
|
+
import './chunk-utils-timers.ab764c0c.js';
|
|
14
|
+
import 'fs';
|
|
15
|
+
import './chunk-utils-source-map.175ffa40.js';
|
|
16
|
+
import './spy.js';
|
|
17
|
+
import 'tinyspy';
|
|
18
|
+
|
|
19
|
+
function registerApiGlobally() {
|
|
20
|
+
globalApis.forEach((api) => {
|
|
21
|
+
globalThis[api] = index[api];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { registerApiGlobally };
|
|
@@ -77,11 +77,10 @@ class Chunk {
|
|
|
77
77
|
this.storeName = false;
|
|
78
78
|
this.edited = false;
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
80
|
+
{
|
|
81
|
+
this.previous = null;
|
|
82
|
+
this.next = null;
|
|
83
|
+
}
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
appendLeft(content) {
|
|
@@ -724,6 +723,11 @@ class MagicString {
|
|
|
724
723
|
}
|
|
725
724
|
|
|
726
725
|
overwrite(start, end, content, options) {
|
|
726
|
+
options = options || {};
|
|
727
|
+
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
update(start, end, content, options) {
|
|
727
731
|
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
728
732
|
|
|
729
733
|
while (start < 0) start += this.original.length;
|
|
@@ -749,7 +753,7 @@ class MagicString {
|
|
|
749
753
|
options = { storeName: true };
|
|
750
754
|
}
|
|
751
755
|
const storeName = options !== undefined ? options.storeName : false;
|
|
752
|
-
const
|
|
756
|
+
const overwrite = options !== undefined ? options.overwrite : false;
|
|
753
757
|
|
|
754
758
|
if (storeName) {
|
|
755
759
|
const original = this.original.slice(start, end);
|
|
@@ -773,7 +777,7 @@ class MagicString {
|
|
|
773
777
|
chunk.edit('', false);
|
|
774
778
|
}
|
|
775
779
|
|
|
776
|
-
first.edit(content, storeName,
|
|
780
|
+
first.edit(content, storeName, !overwrite);
|
|
777
781
|
} else {
|
|
778
782
|
// must be inserting at the end
|
|
779
783
|
const newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
@@ -1092,7 +1096,7 @@ class MagicString {
|
|
|
1092
1096
|
return this.original !== this.toString();
|
|
1093
1097
|
}
|
|
1094
1098
|
|
|
1095
|
-
|
|
1099
|
+
_replaceRegexp(searchValue, replacement) {
|
|
1096
1100
|
function getReplacement(match, str) {
|
|
1097
1101
|
if (typeof replacement === 'string') {
|
|
1098
1102
|
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
@@ -1115,7 +1119,7 @@ class MagicString {
|
|
|
1115
1119
|
}
|
|
1116
1120
|
return matches;
|
|
1117
1121
|
}
|
|
1118
|
-
if (
|
|
1122
|
+
if (searchValue.global) {
|
|
1119
1123
|
const matches = matchAll(searchValue, this.original);
|
|
1120
1124
|
matches.forEach((match) => {
|
|
1121
1125
|
if (match.index != null)
|
|
@@ -1136,6 +1140,53 @@ class MagicString {
|
|
|
1136
1140
|
}
|
|
1137
1141
|
return this;
|
|
1138
1142
|
}
|
|
1143
|
+
|
|
1144
|
+
_replaceString(string, replacement) {
|
|
1145
|
+
const { original } = this;
|
|
1146
|
+
const index = original.indexOf(string);
|
|
1147
|
+
|
|
1148
|
+
if (index !== -1) {
|
|
1149
|
+
this.overwrite(index, index + string.length, replacement);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
return this;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
replace(searchValue, replacement) {
|
|
1156
|
+
if (typeof searchValue === 'string') {
|
|
1157
|
+
return this._replaceString(searchValue, replacement);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
_replaceAllString(string, replacement) {
|
|
1164
|
+
const { original } = this;
|
|
1165
|
+
const stringLength = string.length;
|
|
1166
|
+
for (
|
|
1167
|
+
let index = original.indexOf(string);
|
|
1168
|
+
index !== -1;
|
|
1169
|
+
index = original.indexOf(string, index + stringLength)
|
|
1170
|
+
) {
|
|
1171
|
+
this.overwrite(index, index + stringLength, replacement);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
return this;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
replaceAll(searchValue, replacement) {
|
|
1178
|
+
if (typeof searchValue === 'string') {
|
|
1179
|
+
return this._replaceAllString(searchValue, replacement);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
if (!searchValue.global) {
|
|
1183
|
+
throw new TypeError(
|
|
1184
|
+
'MagicString.prototype.replaceAll called with a non-global RegExp argument'
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
1189
|
+
}
|
|
1139
1190
|
}
|
|
1140
1191
|
|
|
1141
1192
|
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from 'path';
|
|
2
|
-
import { r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.
|
|
2
|
+
import { r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.22640ce4.js';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
4
|
|
|
5
5
|
const RealDate = Date;
|
|
@@ -266,14 +266,14 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
266
266
|
`));
|
|
267
267
|
if (!promptInstall)
|
|
268
268
|
return false;
|
|
269
|
-
const prompts = await import('./vendor-index.
|
|
269
|
+
const prompts = await import('./vendor-index.9f20a9be.js').then(function (n) { return n.i; });
|
|
270
270
|
const { install } = await prompts.prompt({
|
|
271
271
|
type: "confirm",
|
|
272
272
|
name: "install",
|
|
273
273
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
274
274
|
});
|
|
275
275
|
if (install) {
|
|
276
|
-
await (await import('./chunk-install-pkg.
|
|
276
|
+
await (await import('./chunk-install-pkg.107b0cd7.js')).installPackage(dependency, { dev: true });
|
|
277
277
|
process.stderr.write(picocolors.exports.yellow(`
|
|
278
278
|
Package ${dependency} installed, re-run the command to start.
|
|
279
279
|
`));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as resolve } from './chunk-constants.
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
1
|
+
import { a as resolve } from './chunk-constants.22640ce4.js';
|
|
2
|
+
import { e as execa } from './vendor-index.07e6fc5a.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'buffer';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
import 'process';
|
|
9
|
-
import './vendor-index.
|
|
10
|
-
import './vendor-_commonjsHelpers.
|
|
9
|
+
import './vendor-index.95542d0a.js';
|
|
10
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'os';
|
|
15
|
-
import './vendor-index.
|
|
15
|
+
import './vendor-index.8919d83a.js';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
18
|
|
|
@@ -1,14 +1,14 @@
|
|
|
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,
|
|
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-mock-date.b1b404e8.js';
|
|
3
3
|
import * as chai$2 from 'chai';
|
|
4
4
|
import { expect, AssertionError, util } from 'chai';
|
|
5
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
5
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.4f6f88e8.js';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
|
-
import { j as join, d as dirname, p as picocolors } from './chunk-constants.
|
|
9
|
-
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.
|
|
10
|
-
import { isMockFunction } from './spy.
|
|
11
|
-
import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.
|
|
8
|
+
import { j as join, d as dirname, p as picocolors } from './chunk-constants.22640ce4.js';
|
|
9
|
+
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.175ffa40.js';
|
|
10
|
+
import { isMockFunction } from './spy.js';
|
|
11
|
+
import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.ab764c0c.js';
|
|
12
12
|
|
|
13
13
|
function createChainable(keys, fn) {
|
|
14
14
|
function create(context) {
|
|
@@ -125,7 +125,7 @@ function equals(a, b, customTesters, strictCheck) {
|
|
|
125
125
|
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
|
126
126
|
}
|
|
127
127
|
function isAsymmetric(obj) {
|
|
128
|
-
return !!obj && isA("Function", obj.asymmetricMatch);
|
|
128
|
+
return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
|
|
129
129
|
}
|
|
130
130
|
function asymmetricMatch(a, b) {
|
|
131
131
|
const asymmetricA = isAsymmetric(a);
|
|
@@ -600,7 +600,7 @@ function deepMergeSnapshot(target, source) {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
async function saveInlineSnapshots(snapshots) {
|
|
603
|
-
const MagicString = (await import('./chunk-magic-string.
|
|
603
|
+
const MagicString = (await import('./chunk-magic-string.ffe2b171.js')).default;
|
|
604
604
|
const files = new Set(snapshots.map((i) => i.file));
|
|
605
605
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
606
606
|
const map = await rpc().getSourceMap(file);
|
|
@@ -617,7 +617,7 @@ async function saveInlineSnapshots(snapshots) {
|
|
|
617
617
|
await promises.writeFile(file, transformed, "utf-8");
|
|
618
618
|
}));
|
|
619
619
|
}
|
|
620
|
-
const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*({)/m;
|
|
620
|
+
const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\S\s]*\*\/\s*|\/\/.*\s+)*\s*({)/m;
|
|
621
621
|
function replaceObjectSnap(code, s, index, newSnap) {
|
|
622
622
|
code = code.slice(index);
|
|
623
623
|
const startMatch = startObjectRegex.exec(code);
|
|
@@ -645,7 +645,7 @@ function prepareSnapString(snap, source, index) {
|
|
|
645
645
|
${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")}
|
|
646
646
|
${indent}${quote}`;
|
|
647
647
|
}
|
|
648
|
-
const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*[\w_$]*(['"`\)])/m;
|
|
648
|
+
const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\S\s]*\*\/\s*|\/\/.*\s+)*\s*[\w_$]*(['"`\)])/m;
|
|
649
649
|
function replaceInlineSnap(code, s, index, newSnap) {
|
|
650
650
|
const startMatch = startRegex.exec(code.slice(index));
|
|
651
651
|
if (!startMatch)
|
|
@@ -1588,7 +1588,7 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1588
1588
|
thrown && thrown.message
|
|
1589
1589
|
);
|
|
1590
1590
|
}
|
|
1591
|
-
if (typeof expected.asymmetricMatch === "function") {
|
|
1591
|
+
if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") {
|
|
1592
1592
|
const matcher = expected;
|
|
1593
1593
|
return this.assert(
|
|
1594
1594
|
thrown && matcher.asymmetricMatch(thrown),
|
|
@@ -2184,7 +2184,7 @@ const test = createTest(
|
|
|
2184
2184
|
}
|
|
2185
2185
|
);
|
|
2186
2186
|
const bench = createBenchmark(
|
|
2187
|
-
function(name, fn, options) {
|
|
2187
|
+
function(name, fn = noop, options = {}) {
|
|
2188
2188
|
getCurrentSuite().benchmark.fn.call(this, name, fn, options);
|
|
2189
2189
|
}
|
|
2190
2190
|
);
|
|
@@ -2257,8 +2257,8 @@ function createSuiteCollector(name, factory = () => {
|
|
|
2257
2257
|
));
|
|
2258
2258
|
tasks.push(test3);
|
|
2259
2259
|
});
|
|
2260
|
-
const benchmark = createBenchmark(function(name2, fn = noop, options) {
|
|
2261
|
-
const mode2 = this.only ? "only" : this.skip ? "skip" : "run";
|
|
2260
|
+
const benchmark = createBenchmark(function(name2, fn = noop, options = {}) {
|
|
2261
|
+
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
2262
2262
|
if (!isRunningInBenchmark())
|
|
2263
2263
|
throw new Error("`bench()` is only available in benchmark mode. Run with `vitest bench` instead.");
|
|
2264
2264
|
const benchmark2 = {
|
|
@@ -2362,7 +2362,7 @@ function createTest(fn) {
|
|
|
2362
2362
|
}
|
|
2363
2363
|
function createBenchmark(fn) {
|
|
2364
2364
|
const benchmark = createChainable(
|
|
2365
|
-
["skip", "only"],
|
|
2365
|
+
["skip", "only", "todo"],
|
|
2366
2366
|
fn
|
|
2367
2367
|
);
|
|
2368
2368
|
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
|
-
import { t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.
|
|
3
|
-
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.
|
|
4
|
-
import { k as deepClone, l as getType, o as isNode, g as getWorkerState, R as RealDate, t as toArray, p as relativePath, q as isBrowser, h as isRunningInBenchmark, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, y as createDefer, e as getFullName } from './chunk-mock-date.
|
|
5
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
2
|
+
import { t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.cca09977.js';
|
|
3
|
+
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.1260cc21.js';
|
|
4
|
+
import { k as deepClone, l as getType, o as isNode, g as getWorkerState, R as RealDate, t as toArray, p as relativePath, q as isBrowser, h as isRunningInBenchmark, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, y as createDefer, d as assertTypes, e as getFullName } from './chunk-mock-date.b1b404e8.js';
|
|
5
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.ca293c72.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.4f6f88e8.js';
|
|
7
7
|
import util$1 from 'util';
|
|
8
8
|
import { util } from 'chai';
|
|
9
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
10
|
-
import { e as environments } from './chunk-env-node.
|
|
11
|
-
import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.
|
|
9
|
+
import { s as stringify } from './chunk-utils-source-map.175ffa40.js';
|
|
10
|
+
import { e as environments } from './chunk-env-node.700b7e95.js';
|
|
11
|
+
import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.ab764c0c.js';
|
|
12
12
|
|
|
13
13
|
const OBJECT_PROTO = Object.getPrototypeOf({});
|
|
14
14
|
function getUnserializableMessage(err) {
|
|
@@ -154,7 +154,7 @@ async function setupGlobalEnv(config) {
|
|
|
154
154
|
if (isNode)
|
|
155
155
|
await setupConsoleLogSpy();
|
|
156
156
|
if (config.globals)
|
|
157
|
-
(await import('./chunk-integrations-globals.
|
|
157
|
+
(await import('./chunk-integrations-globals.56d5b05b.js')).registerApiGlobally();
|
|
158
158
|
}
|
|
159
159
|
function setupDefines(defines) {
|
|
160
160
|
for (const key in defines)
|
|
@@ -433,7 +433,7 @@ function calculateHash(parent) {
|
|
|
433
433
|
|
|
434
434
|
async function importTinybench() {
|
|
435
435
|
if (!globalThis.EventTarget)
|
|
436
|
-
await import('./vendor-index.
|
|
436
|
+
await import('./vendor-index.534e612c.js').then(function (n) { return n.i; });
|
|
437
437
|
return await import('tinybench');
|
|
438
438
|
}
|
|
439
439
|
const now = Date.now;
|
|
@@ -487,10 +487,18 @@ async function sendTasksUpdate() {
|
|
|
487
487
|
return p;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
+
const callCleanupHooks = async (cleanups) => {
|
|
491
|
+
await Promise.all(cleanups.map(async (fn) => {
|
|
492
|
+
if (!fn)
|
|
493
|
+
return;
|
|
494
|
+
assertTypes(fn, "hook teardown", ["function"]);
|
|
495
|
+
await fn();
|
|
496
|
+
}));
|
|
497
|
+
};
|
|
490
498
|
async function runTest(test) {
|
|
491
499
|
var _a, _b;
|
|
492
500
|
if (test.mode !== "run") {
|
|
493
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
501
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.ca293c72.js').then(function (n) { return n.q; });
|
|
494
502
|
getSnapshotClient().skipTestSnapshots(test);
|
|
495
503
|
return;
|
|
496
504
|
}
|
|
@@ -506,7 +514,7 @@ async function runTest(test) {
|
|
|
506
514
|
updateTask(test);
|
|
507
515
|
clearModuleMocks();
|
|
508
516
|
if (isNode) {
|
|
509
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
517
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.ca293c72.js').then(function (n) { return n.q; });
|
|
510
518
|
await getSnapshotClient().setTest(test);
|
|
511
519
|
}
|
|
512
520
|
const workerState = getWorkerState();
|
|
@@ -545,7 +553,7 @@ async function runTest(test) {
|
|
|
545
553
|
}
|
|
546
554
|
try {
|
|
547
555
|
await callSuiteHook(test.suite, test, "afterEach", [test.context, test.suite]);
|
|
548
|
-
await
|
|
556
|
+
await callCleanupHooks(beforeEachCleanups);
|
|
549
557
|
} catch (e) {
|
|
550
558
|
test.result.state = "fail";
|
|
551
559
|
test.result.error = processError(e);
|
|
@@ -566,7 +574,7 @@ async function runTest(test) {
|
|
|
566
574
|
if (isBrowser && test.result.error)
|
|
567
575
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
568
576
|
if (isNode) {
|
|
569
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
577
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.ca293c72.js').then(function (n) { return n.q; });
|
|
570
578
|
getSnapshotClient().clearTest();
|
|
571
579
|
}
|
|
572
580
|
test.result.duration = now() - start;
|
|
@@ -626,7 +634,7 @@ async function runSuite(suite) {
|
|
|
626
634
|
}
|
|
627
635
|
}
|
|
628
636
|
await callSuiteHook(suite, suite, "afterAll", [suite]);
|
|
629
|
-
await
|
|
637
|
+
await callCleanupHooks(beforeAllCleanups);
|
|
630
638
|
} catch (e) {
|
|
631
639
|
suite.result.state = "fail";
|
|
632
640
|
suite.result.error = processError(e);
|
|
@@ -769,7 +777,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
769
777
|
async function startTestsNode(paths, config) {
|
|
770
778
|
const files = await collectTests(paths, config);
|
|
771
779
|
rpc().onCollected(files);
|
|
772
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
780
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.ca293c72.js').then(function (n) { return n.q; });
|
|
773
781
|
getSnapshotClient().clear();
|
|
774
782
|
await runFiles(files, config);
|
|
775
783
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|