vitest 0.20.2 → 0.20.3
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 +22 -7
- package/dist/browser.mjs +3 -3
- package/dist/{chunk-api-setup.7c4c8879.mjs → chunk-api-setup.9bff74bb.mjs} +2 -2
- package/dist/{chunk-defaults.1c51d585.mjs → chunk-defaults.6698a2d3.mjs} +1 -1
- package/dist/{chunk-integrations-globals.56a11010.mjs → chunk-integrations-globals.c5b78414.mjs} +1 -1
- package/dist/{chunk-runtime-error.0aa0dc06.mjs → chunk-runtime-error.034e03ba.mjs} +3 -3
- package/dist/{chunk-runtime-hooks.3ee34848.mjs → chunk-runtime-hooks.a8401528.mjs} +1 -1
- package/dist/{chunk-runtime-mocker.0a8f7c5e.mjs → chunk-runtime-mocker.653847b2.mjs} +2 -2
- package/dist/{chunk-vite-node-client.a247c2c2.mjs → chunk-vite-node-client.115caed2.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.45323563.mjs → chunk-vite-node-externalize.91ae6e85.mjs} +15 -9
- package/dist/{chunk-vite-node-utils.9dfd1e3f.mjs → chunk-vite-node-utils.7e46948f.mjs} +0 -0
- package/dist/cli.mjs +4 -4
- package/dist/entry.mjs +3 -3
- package/dist/index.d.ts +51 -7
- package/dist/index.mjs +1 -1
- package/dist/loader.mjs +1 -1
- package/dist/node.d.ts +22 -7
- package/dist/node.mjs +5 -5
- package/dist/worker.mjs +3 -3
- package/package.json +10 -10
package/dist/browser.d.ts
CHANGED
|
@@ -209,18 +209,26 @@ interface CustomEventMap {
|
|
|
209
209
|
type InferCustomEventPayload<T extends string> =
|
|
210
210
|
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
211
211
|
|
|
212
|
+
type ModuleNamespace = Record<string, any> & {
|
|
213
|
+
[Symbol.toStringTag]: 'Module'
|
|
214
|
+
}
|
|
215
|
+
|
|
212
216
|
interface ViteHotContext {
|
|
213
217
|
readonly data: any
|
|
214
218
|
|
|
215
219
|
accept(): void
|
|
216
|
-
accept(cb: (mod:
|
|
217
|
-
accept(dep: string, cb: (mod:
|
|
218
|
-
accept(
|
|
220
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
221
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
222
|
+
accept(
|
|
223
|
+
deps: readonly string[],
|
|
224
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
225
|
+
): void
|
|
219
226
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
acceptExports(exportNames: string | readonly string[]): void
|
|
228
|
+
acceptExports(
|
|
229
|
+
exportNames: string | readonly string[],
|
|
230
|
+
cb: (mod: ModuleNamespace | undefined) => void
|
|
231
|
+
): void
|
|
224
232
|
|
|
225
233
|
dispose(cb: (data: any) => void): void
|
|
226
234
|
decline(): void
|
|
@@ -574,6 +582,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
574
582
|
private _lastRunTimeout;
|
|
575
583
|
private _lastRunTimer;
|
|
576
584
|
private _lastRunCount;
|
|
585
|
+
private _timeStart;
|
|
577
586
|
constructor();
|
|
578
587
|
onInit(ctx: Vitest): void;
|
|
579
588
|
relative(path: string): string;
|
|
@@ -776,6 +785,12 @@ interface C8Options {
|
|
|
776
785
|
* @default false
|
|
777
786
|
*/
|
|
778
787
|
cleanOnRerun?: boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Check thresholds per file
|
|
790
|
+
*
|
|
791
|
+
* @default false
|
|
792
|
+
*/
|
|
793
|
+
perFile?: boolean;
|
|
779
794
|
/**
|
|
780
795
|
* Allow files from outside of your cwd.
|
|
781
796
|
*
|
package/dist/browser.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.b6c2cdbc.mjs';
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.
|
|
3
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.a8401528.mjs';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.034e03ba.mjs';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
@@ -17,6 +17,6 @@ import 'fs';
|
|
|
17
17
|
import './chunk-utils-source-map.8198ebd9.mjs';
|
|
18
18
|
import './spy.mjs';
|
|
19
19
|
import 'tinyspy';
|
|
20
|
-
import './chunk-defaults.
|
|
20
|
+
import './chunk-defaults.6698a2d3.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.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.115caed2.mjs';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -17,7 +17,7 @@ import './chunk-mock-date.9160e13b.mjs';
|
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'tty';
|
|
19
19
|
import 'local-pkg';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-vite-node-utils.7e46948f.mjs';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'util';
|
|
23
23
|
import 'debug';
|
|
@@ -551,7 +551,7 @@ function isClassLikeName(name) {
|
|
|
551
551
|
function populateGlobal(global, win, options = {}) {
|
|
552
552
|
const { bindFunctions = false } = options;
|
|
553
553
|
const keys = getWindowKeys(global, win);
|
|
554
|
-
const originals = new Map(allowRewrite.map((
|
|
554
|
+
const originals = new Map(allowRewrite.filter((key) => key in global).map((key) => [key, global[key]]));
|
|
555
555
|
const overrideObject = /* @__PURE__ */ new Map();
|
|
556
556
|
for (const key of keys) {
|
|
557
557
|
const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
|
package/dist/{chunk-integrations-globals.56a11010.mjs → chunk-integrations-globals.c5b78414.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as globalApis } from './chunk-constants.16825f0c.mjs';
|
|
2
|
-
import { i as index } from './chunk-runtime-hooks.
|
|
2
|
+
import { i as index } from './chunk-runtime-hooks.a8401528.mjs';
|
|
3
3
|
import 'url';
|
|
4
4
|
import './chunk-mock-date.9160e13b.mjs';
|
|
5
5
|
import 'path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.
|
|
2
|
-
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.
|
|
1
|
+
import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.6698a2d3.mjs';
|
|
2
|
+
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.a8401528.mjs';
|
|
3
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.9160e13b.mjs';
|
|
4
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.b6c2cdbc.mjs';
|
|
5
5
|
import { r as rpc } from './chunk-runtime-rpc.dbf0b31d.mjs';
|
|
@@ -130,7 +130,7 @@ async function setupGlobalEnv(config) {
|
|
|
130
130
|
if (isNode)
|
|
131
131
|
await setupConsoleLogSpy();
|
|
132
132
|
if (config.globals)
|
|
133
|
-
(await import('./chunk-integrations-globals.
|
|
133
|
+
(await import('./chunk-integrations-globals.c5b78414.mjs')).registerApiGlobally();
|
|
134
134
|
}
|
|
135
135
|
function setupDefines(defines) {
|
|
136
136
|
for (const key in defines)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-client.115caed2.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
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 getAllProperties } from './chunk-mock-date.9160e13b.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.
|
|
5
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.7e46948f.mjs';
|
|
6
6
|
import { d as distDir } from './chunk-constants.16825f0c.mjs';
|
|
7
7
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
4
|
import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.9160e13b.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.
|
|
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.7e46948f.mjs';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
package/dist/{chunk-vite-node-externalize.45323563.mjs → chunk-vite-node-externalize.91ae6e85.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as join, z as basename, d as dirname, y as resolve, 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.9160e13b.mjs';
|
|
2
|
-
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.
|
|
2
|
+
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.6698a2d3.mjs';
|
|
3
3
|
import { loadConfigFromFile, createServer, mergeConfig } from 'vite';
|
|
4
4
|
import path$a from 'path';
|
|
5
5
|
import _url, { fileURLToPath } from 'url';
|
|
@@ -11,9 +11,9 @@ 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.
|
|
14
|
+
import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.115caed2.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.
|
|
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.7e46948f.mjs';
|
|
17
17
|
import { MessageChannel } from 'worker_threads';
|
|
18
18
|
import { Tinypool } from 'tinypool';
|
|
19
19
|
import { performance } from 'perf_hooks';
|
|
@@ -26,7 +26,7 @@ import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
|
26
26
|
import require$$0$2 from 'readline';
|
|
27
27
|
import { p as prompts } from './vendor-index.de788b6a.mjs';
|
|
28
28
|
|
|
29
|
-
var version$1 = "0.20.
|
|
29
|
+
var version$1 = "0.20.3";
|
|
30
30
|
|
|
31
31
|
class EndError extends Error {
|
|
32
32
|
constructor(value) {
|
|
@@ -7292,6 +7292,9 @@ function elegantSpinner() {
|
|
|
7292
7292
|
return spinnerFrames[index];
|
|
7293
7293
|
};
|
|
7294
7294
|
}
|
|
7295
|
+
function formatTimeString(date) {
|
|
7296
|
+
return date.toTimeString().split(" ")[0];
|
|
7297
|
+
}
|
|
7295
7298
|
|
|
7296
7299
|
var _a;
|
|
7297
7300
|
const BADGE_PADDING = " ";
|
|
@@ -7313,6 +7316,7 @@ class BaseReporter {
|
|
|
7313
7316
|
this._filesInWatchMode = /* @__PURE__ */ new Map();
|
|
7314
7317
|
this._lastRunTimeout = 0;
|
|
7315
7318
|
this._lastRunCount = 0;
|
|
7319
|
+
this._timeStart = new Date();
|
|
7316
7320
|
this.registerUnhandledRejection();
|
|
7317
7321
|
}
|
|
7318
7322
|
onInit(ctx) {
|
|
@@ -7426,6 +7430,7 @@ ${BADGE}${TRIGGER}
|
|
|
7426
7430
|
${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
|
|
7427
7431
|
`);
|
|
7428
7432
|
}
|
|
7433
|
+
this._timeStart = new Date();
|
|
7429
7434
|
this.start = performance.now();
|
|
7430
7435
|
}
|
|
7431
7436
|
onUserConsoleLog(log) {
|
|
@@ -7496,10 +7501,11 @@ ${BADGE}${TRIGGER} ${picocolors.exports.blue(`x${rerun}`)}
|
|
|
7496
7501
|
}
|
|
7497
7502
|
logger.log(padTitle("Test Files"), getStateString(files));
|
|
7498
7503
|
logger.log(padTitle("Tests"), getStateString(tests));
|
|
7504
|
+
logger.log(padTitle("Start at"), formatTimeString(this._timeStart));
|
|
7499
7505
|
if (this.watchFilters)
|
|
7500
|
-
logger.log(padTitle("
|
|
7506
|
+
logger.log(padTitle("Duration"), time(threadTime));
|
|
7501
7507
|
else
|
|
7502
|
-
logger.log(padTitle("
|
|
7508
|
+
logger.log(padTitle("Duration"), time(executionTime) + picocolors.exports.gray(` (setup ${time(setupTime)}, collect ${time(collectTime)}, tests ${time(testsTime)})`));
|
|
7503
7509
|
logger.log();
|
|
7504
7510
|
}
|
|
7505
7511
|
async printTaskErrors(tasks, errorDivider) {
|
|
@@ -8567,7 +8573,7 @@ function resolveConfig(options, viteConfig) {
|
|
|
8567
8573
|
resolved.deps.inline.push(...extraInlineDeps);
|
|
8568
8574
|
}
|
|
8569
8575
|
}
|
|
8570
|
-
(_c = resolved.deps).registerNodeLoader ?? (_c.registerNodeLoader =
|
|
8576
|
+
(_c = resolved.deps).registerNodeLoader ?? (_c.registerNodeLoader = typeof process.versions.pnp === "undefined");
|
|
8571
8577
|
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
|
|
8572
8578
|
const CI = !!process.env.CI;
|
|
8573
8579
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
@@ -9093,7 +9099,7 @@ createLogUpdate(process$1.stdout);
|
|
|
9093
9099
|
|
|
9094
9100
|
createLogUpdate(process$1.stderr);
|
|
9095
9101
|
|
|
9096
|
-
var version = "0.20.
|
|
9102
|
+
var version = "0.20.3";
|
|
9097
9103
|
|
|
9098
9104
|
function fileFromParsedStack(stack) {
|
|
9099
9105
|
var _a, _b;
|
|
@@ -10046,7 +10052,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10046
10052
|
await ctx.setServer(options, server);
|
|
10047
10053
|
haveStarted = true;
|
|
10048
10054
|
if (options.api && options.watch)
|
|
10049
|
-
(await import('./chunk-api-setup.
|
|
10055
|
+
(await import('./chunk-api-setup.9bff74bb.mjs')).setup(ctx);
|
|
10050
10056
|
} catch (err) {
|
|
10051
10057
|
ctx.logger.printError(err, true);
|
|
10052
10058
|
process.exit(1);
|
|
File without changes
|
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { p as picocolors } from './chunk-mock-date.9160e13b.mjs';
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.91ae6e85.mjs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
|
-
import './chunk-defaults.
|
|
7
|
+
import './chunk-defaults.6698a2d3.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
@@ -15,9 +15,9 @@ import 'os';
|
|
|
15
15
|
import 'util';
|
|
16
16
|
import 'stream';
|
|
17
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
18
|
-
import './chunk-vite-node-client.
|
|
18
|
+
import './chunk-vite-node-client.115caed2.mjs';
|
|
19
19
|
import 'vm';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-vite-node-utils.7e46948f.mjs';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'debug';
|
|
23
23
|
import 'worker_threads';
|
package/dist/entry.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
2
|
import { a as resetModules } from './chunk-mock-date.9160e13b.mjs';
|
|
3
|
-
import { f as envs } from './chunk-defaults.
|
|
4
|
-
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.
|
|
3
|
+
import { f as envs } from './chunk-defaults.6698a2d3.mjs';
|
|
4
|
+
import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-error.034e03ba.mjs';
|
|
5
5
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
6
6
|
import 'path';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
|
-
import './chunk-runtime-hooks.
|
|
11
|
+
import './chunk-runtime-hooks.a8401528.mjs';
|
|
12
12
|
import './chunk-runtime-chain.b6c2cdbc.mjs';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'chai';
|
package/dist/index.d.ts
CHANGED
|
@@ -209,18 +209,26 @@ interface CustomEventMap {
|
|
|
209
209
|
type InferCustomEventPayload<T extends string> =
|
|
210
210
|
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
211
211
|
|
|
212
|
+
type ModuleNamespace = Record<string, any> & {
|
|
213
|
+
[Symbol.toStringTag]: 'Module'
|
|
214
|
+
}
|
|
215
|
+
|
|
212
216
|
interface ViteHotContext {
|
|
213
217
|
readonly data: any
|
|
214
218
|
|
|
215
219
|
accept(): void
|
|
216
|
-
accept(cb: (mod:
|
|
217
|
-
accept(dep: string, cb: (mod:
|
|
218
|
-
accept(
|
|
220
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
221
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
222
|
+
accept(
|
|
223
|
+
deps: readonly string[],
|
|
224
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
225
|
+
): void
|
|
219
226
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
acceptExports(exportNames: string | readonly string[]): void
|
|
228
|
+
acceptExports(
|
|
229
|
+
exportNames: string | readonly string[],
|
|
230
|
+
cb: (mod: ModuleNamespace | undefined) => void
|
|
231
|
+
): void
|
|
224
232
|
|
|
225
233
|
dispose(cb: (data: any) => void): void
|
|
226
234
|
decline(): void
|
|
@@ -574,6 +582,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
574
582
|
private _lastRunTimeout;
|
|
575
583
|
private _lastRunTimer;
|
|
576
584
|
private _lastRunCount;
|
|
585
|
+
private _timeStart;
|
|
577
586
|
constructor();
|
|
578
587
|
onInit(ctx: Vitest): void;
|
|
579
588
|
relative(path: string): string;
|
|
@@ -776,6 +785,12 @@ interface C8Options {
|
|
|
776
785
|
* @default false
|
|
777
786
|
*/
|
|
778
787
|
cleanOnRerun?: boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Check thresholds per file
|
|
790
|
+
*
|
|
791
|
+
* @default false
|
|
792
|
+
*/
|
|
793
|
+
perFile?: boolean;
|
|
779
794
|
/**
|
|
780
795
|
* Allow files from outside of your cwd.
|
|
781
796
|
*
|
|
@@ -1856,11 +1871,19 @@ interface Mock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TA
|
|
|
1856
1871
|
new (...args: TArgs): TReturns;
|
|
1857
1872
|
(...args: TArgs): TReturns;
|
|
1858
1873
|
}
|
|
1874
|
+
interface PartialMock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, Partial<TReturns>> {
|
|
1875
|
+
new (...args: TArgs): TReturns;
|
|
1876
|
+
(...args: TArgs): TReturns;
|
|
1877
|
+
}
|
|
1859
1878
|
declare type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? Mock<ConstructorParameters<T>, R> : T;
|
|
1860
1879
|
declare type MockedFunction<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & {
|
|
1861
1880
|
[K in keyof T]: T[K];
|
|
1862
1881
|
};
|
|
1882
|
+
declare type PartiallyMockedFunction<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & {
|
|
1883
|
+
[K in keyof T]: T[K];
|
|
1884
|
+
};
|
|
1863
1885
|
declare type MockedFunctionDeep<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
1886
|
+
declare type PartiallyMockedFunctionDeep<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
1864
1887
|
declare type MockedObject<T> = MaybeMockedConstructor<T> & {
|
|
1865
1888
|
[K in Methods<T>]: T[K] extends Procedure ? MockedFunction<T[K]> : T[K];
|
|
1866
1889
|
} & {
|
|
@@ -1872,7 +1895,9 @@ declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
|
|
1872
1895
|
[K in Properties<T>]: MaybeMockedDeep<T[K]>;
|
|
1873
1896
|
};
|
|
1874
1897
|
declare type MaybeMockedDeep<T> = T extends Procedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
1898
|
+
declare type MaybePartiallyMockedDeep<T> = T extends Procedure ? PartiallyMockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
1875
1899
|
declare type MaybeMocked<T> = T extends Procedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
1900
|
+
declare type MaybePartiallyMocked<T> = T extends Procedure ? PartiallyMockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
1876
1901
|
interface Constructable {
|
|
1877
1902
|
new (...args: any[]): any;
|
|
1878
1903
|
}
|
|
@@ -1990,6 +2015,8 @@ declare class VitestUtils {
|
|
|
1990
2015
|
importMock<T>(path: string): Promise<MaybeMockedDeep<T>>;
|
|
1991
2016
|
/**
|
|
1992
2017
|
* Type helpers for TypeScript. In reality just returns the object that was passed.
|
|
2018
|
+
*
|
|
2019
|
+
* When `partial` is `true` it will expect a `Partial<T>` as a return value.
|
|
1993
2020
|
* @example
|
|
1994
2021
|
* import example from './example'
|
|
1995
2022
|
* vi.mock('./example')
|
|
@@ -2003,9 +2030,26 @@ declare class VitestUtils {
|
|
|
2003
2030
|
* })
|
|
2004
2031
|
* @param item Anything that can be mocked
|
|
2005
2032
|
* @param deep If the object is deeply mocked
|
|
2033
|
+
* @param options If the object is partially or deeply mocked
|
|
2006
2034
|
*/
|
|
2007
2035
|
mocked<T>(item: T, deep?: false): MaybeMocked<T>;
|
|
2008
2036
|
mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
|
|
2037
|
+
mocked<T>(item: T, options: {
|
|
2038
|
+
partial?: false;
|
|
2039
|
+
deep?: false;
|
|
2040
|
+
}): MaybeMocked<T>;
|
|
2041
|
+
mocked<T>(item: T, options: {
|
|
2042
|
+
partial?: false;
|
|
2043
|
+
deep: true;
|
|
2044
|
+
}): MaybeMockedDeep<T>;
|
|
2045
|
+
mocked<T>(item: T, options: {
|
|
2046
|
+
partial: true;
|
|
2047
|
+
deep?: false;
|
|
2048
|
+
}): MaybePartiallyMocked<T>;
|
|
2049
|
+
mocked<T>(item: T, options: {
|
|
2050
|
+
partial: true;
|
|
2051
|
+
deep: true;
|
|
2052
|
+
}): MaybePartiallyMockedDeep<T>;
|
|
2009
2053
|
isMockFunction(fn: any): fn is EnhancedSpy;
|
|
2010
2054
|
clearAllMocks(): this;
|
|
2011
2055
|
resetAllMocks(): this;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.b6c2cdbc.mjs';
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.a8401528.mjs';
|
|
3
3
|
import * as chai from 'chai';
|
|
4
4
|
export { chai };
|
|
5
5
|
export { assert, should } from 'chai';
|
package/dist/loader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
|
-
import { i as isNodeBuiltin, d as normalizeModuleId } from './chunk-vite-node-utils.
|
|
2
|
+
import { i as isNodeBuiltin, d as normalizeModuleId } from './chunk-vite-node-utils.7e46948f.mjs';
|
|
3
3
|
import './chunk-mock-date.9160e13b.mjs';
|
|
4
4
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
5
5
|
import 'module';
|
package/dist/node.d.ts
CHANGED
|
@@ -51,18 +51,26 @@ interface CustomEventMap {
|
|
|
51
51
|
type InferCustomEventPayload<T extends string> =
|
|
52
52
|
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
53
53
|
|
|
54
|
+
type ModuleNamespace = Record<string, any> & {
|
|
55
|
+
[Symbol.toStringTag]: 'Module'
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
interface ViteHotContext {
|
|
55
59
|
readonly data: any
|
|
56
60
|
|
|
57
61
|
accept(): void
|
|
58
|
-
accept(cb: (mod:
|
|
59
|
-
accept(dep: string, cb: (mod:
|
|
60
|
-
accept(
|
|
62
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
63
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
64
|
+
accept(
|
|
65
|
+
deps: readonly string[],
|
|
66
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void
|
|
67
|
+
): void
|
|
61
68
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
acceptExports(exportNames: string | readonly string[]): void
|
|
70
|
+
acceptExports(
|
|
71
|
+
exportNames: string | readonly string[],
|
|
72
|
+
cb: (mod: ModuleNamespace | undefined) => void
|
|
73
|
+
): void
|
|
66
74
|
|
|
67
75
|
dispose(cb: (data: any) => void): void
|
|
68
76
|
decline(): void
|
|
@@ -391,6 +399,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
391
399
|
private _lastRunTimeout;
|
|
392
400
|
private _lastRunTimer;
|
|
393
401
|
private _lastRunCount;
|
|
402
|
+
private _timeStart;
|
|
394
403
|
constructor();
|
|
395
404
|
onInit(ctx: Vitest): void;
|
|
396
405
|
relative(path: string): string;
|
|
@@ -604,6 +613,12 @@ interface C8Options {
|
|
|
604
613
|
* @default false
|
|
605
614
|
*/
|
|
606
615
|
cleanOnRerun?: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Check thresholds per file
|
|
618
|
+
*
|
|
619
|
+
* @default false
|
|
620
|
+
*/
|
|
621
|
+
perFile?: boolean;
|
|
607
622
|
/**
|
|
608
623
|
* Allow files from outside of your cwd.
|
|
609
624
|
*
|
package/dist/node.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.91ae6e85.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.653847b2.mjs';
|
|
3
3
|
import './chunk-mock-date.9160e13b.mjs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
|
-
import './chunk-defaults.
|
|
7
|
+
import './chunk-defaults.6698a2d3.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
@@ -16,9 +16,9 @@ import 'util';
|
|
|
16
16
|
import 'stream';
|
|
17
17
|
import 'events';
|
|
18
18
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
19
|
-
import './chunk-vite-node-client.
|
|
19
|
+
import './chunk-vite-node-client.115caed2.mjs';
|
|
20
20
|
import 'vm';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
21
|
+
import './chunk-vite-node-utils.7e46948f.mjs';
|
|
22
22
|
import 'assert';
|
|
23
23
|
import 'debug';
|
|
24
24
|
import 'worker_threads';
|
package/dist/worker.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { y as resolve } from './chunk-mock-date.9160e13b.mjs';
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.115caed2.mjs';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { d as distDir } from './chunk-constants.16825f0c.mjs';
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.653847b2.mjs';
|
|
6
6
|
import { r as rpc } from './chunk-runtime-rpc.dbf0b31d.mjs';
|
|
7
7
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
8
8
|
import 'path';
|
|
@@ -11,7 +11,7 @@ import 'local-pkg';
|
|
|
11
11
|
import 'module';
|
|
12
12
|
import 'url';
|
|
13
13
|
import 'vm';
|
|
14
|
-
import './chunk-vite-node-utils.
|
|
14
|
+
import './chunk-vite-node-utils.7e46948f.mjs';
|
|
15
15
|
import 'fs';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'util';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -102,17 +102,17 @@
|
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@antfu/install-pkg": "^0.1.0",
|
|
105
|
-
"@edge-runtime/vm": "1.1.0-beta.
|
|
105
|
+
"@edge-runtime/vm": "1.1.0-beta.23",
|
|
106
106
|
"@sinonjs/fake-timers": "^9.1.2",
|
|
107
107
|
"@types/diff": "^5.0.2",
|
|
108
|
-
"@types/jsdom": "^
|
|
108
|
+
"@types/jsdom": "^20.0.0",
|
|
109
109
|
"@types/micromatch": "^4.0.2",
|
|
110
110
|
"@types/natural-compare": "^1.4.1",
|
|
111
111
|
"@types/prompts": "^2.4.0",
|
|
112
112
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
113
|
-
"@vitest/ui": "0.20.
|
|
113
|
+
"@vitest/ui": "0.20.3",
|
|
114
114
|
"birpc": "^0.2.3",
|
|
115
|
-
"c8": "^7.
|
|
115
|
+
"c8": "^7.12.0",
|
|
116
116
|
"cac": "^6.7.12",
|
|
117
117
|
"chai-subset": "^1.6.0",
|
|
118
118
|
"cli-truncate": "^3.1.0",
|
|
@@ -121,12 +121,12 @@
|
|
|
121
121
|
"fast-glob": "^3.2.11",
|
|
122
122
|
"find-up": "^6.3.0",
|
|
123
123
|
"flatted": "^3.2.6",
|
|
124
|
-
"happy-dom": "^6.0.
|
|
125
|
-
"jsdom": "^
|
|
124
|
+
"happy-dom": "^6.0.4",
|
|
125
|
+
"jsdom": "^20.0.0",
|
|
126
126
|
"log-update": "^5.0.1",
|
|
127
127
|
"magic-string": "^0.26.2",
|
|
128
128
|
"micromatch": "^4.0.5",
|
|
129
|
-
"mlly": "^0.5.
|
|
129
|
+
"mlly": "^0.5.5",
|
|
130
130
|
"natural-compare": "^1.4.0",
|
|
131
131
|
"p-limit": "^4.0.0",
|
|
132
132
|
"pathe": "^0.2.0",
|
|
@@ -134,11 +134,11 @@
|
|
|
134
134
|
"pkg-types": "^0.3.3",
|
|
135
135
|
"pretty-format": "^27.5.1",
|
|
136
136
|
"prompts": "^2.4.2",
|
|
137
|
-
"rollup": "^2.77.
|
|
137
|
+
"rollup": "^2.77.2",
|
|
138
138
|
"source-map-js": "^1.0.2",
|
|
139
139
|
"strip-ansi": "^7.0.1",
|
|
140
140
|
"typescript": "^4.7.4",
|
|
141
|
-
"vite-node": "0.20.
|
|
141
|
+
"vite-node": "0.20.3",
|
|
142
142
|
"ws": "^8.8.1"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|