vitest 0.12.4 → 0.12.7
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/{chunk-api-setup.ed61899f.js → chunk-api-setup.2f2df7e0.js} +5 -4
- package/dist/{chunk-constants.0567483c.js → chunk-constants.3570739f.js} +1 -1
- package/dist/{chunk-defaults.ecb46baf.js → chunk-defaults.7d81a6ca.js} +1 -1
- package/dist/{chunk-install-pkg.73b84ae1.js → chunk-install-pkg.fd8d1022.js} +1 -1
- package/dist/chunk-integrations-globals.36dc71fa.js +26 -0
- package/dist/{chunk-magic-string.d5e0e473.js → chunk-magic-string.41232190.js} +0 -4
- package/dist/{chunk-runtime-chain.f8567c17.js → chunk-runtime-chain.5021a6b6.js} +43 -9
- package/dist/{chunk-runtime-mocker.acd615bd.js → chunk-runtime-mocker.42fa71a8.js} +7 -6
- package/dist/{chunk-runtime-rpc.63398738.js → chunk-runtime-rpc.47bae3f9.js} +1 -1
- package/dist/{chunk-utils-global.a5a8641f.js → chunk-utils-global.2fab7e5c.js} +23 -9
- package/dist/{chunk-utils-timers.f25e8f44.js → chunk-utils-timers.da6ac0a6.js} +3 -2
- package/dist/{chunk-vite-node-externalize.cfbecaaf.js → chunk-vite-node-externalize.0aac0c8e.js} +62 -51
- package/dist/{chunk-vite-node-utils.1536f168.js → chunk-vite-node-utils.9975fd9e.js} +6 -1
- package/dist/cli.js +10 -9
- package/dist/config.d.ts +6 -3
- package/dist/entry.js +6 -9
- package/dist/index.d.ts +247 -249
- package/dist/index.js +4 -4
- package/dist/node.d.ts +215 -0
- package/dist/node.js +10 -9
- package/dist/{vendor-entry.d50b0f20.js → vendor-entry.7d6cc1fd.js} +40 -90
- package/dist/{vendor-index.40be925a.js → vendor-index.6c69a0a8.js} +0 -0
- package/dist/worker.js +6 -5
- package/package.json +8 -7
- package/dist/chunk-integrations-globals.f3e83abb.js +0 -29
package/dist/{chunk-vite-node-externalize.cfbecaaf.js → chunk-vite-node-externalize.0aac0c8e.js}
RENAMED
|
@@ -2,28 +2,30 @@ import { Buffer } from 'buffer';
|
|
|
2
2
|
import path$a from 'path';
|
|
3
3
|
import childProcess from 'child_process';
|
|
4
4
|
import process$1 from 'process';
|
|
5
|
-
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.6c69a0a8.js';
|
|
6
6
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import require$$0, { constants as constants$5, cpus, hostname } from 'os';
|
|
8
|
-
import { j as join, f as basename, d as dirname, h as resolve, p as picocolors, s as slash$2, k as isAbsolute, l as relative, m as
|
|
8
|
+
import { j as join, f as basename, d as dirname, h as resolve, p as picocolors, s as slash$2, k as isAbsolute, l as relative, m as isNode, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, x as normalize, n as noop$1, y as deepMerge, z as toNamespacedPath, g as getCallLastIndex, e as notNullish, A as ensurePackageInstalled, B as stdout } from './chunk-utils-global.2fab7e5c.js';
|
|
9
9
|
import { createServer, mergeConfig } from 'vite';
|
|
10
10
|
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
11
|
-
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.
|
|
11
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.3570739f.js';
|
|
12
12
|
import readline from 'readline';
|
|
13
13
|
import require$$0$1 from 'util';
|
|
14
14
|
import require$$0$2 from 'stream';
|
|
15
15
|
import require$$2 from 'events';
|
|
16
16
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
17
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
18
|
-
import
|
|
17
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.9975fd9e.js';
|
|
18
|
+
import createDebug from 'debug';
|
|
19
|
+
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.7d81a6ca.js';
|
|
19
20
|
import { MessageChannel } from 'worker_threads';
|
|
20
21
|
import { Tinypool } from 'tinypool';
|
|
21
22
|
import { performance } from 'perf_hooks';
|
|
22
|
-
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.
|
|
23
|
-
import
|
|
23
|
+
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.da6ac0a6.js';
|
|
24
|
+
import { resolveModule } from 'local-pkg';
|
|
25
|
+
import MagicString from './chunk-magic-string.41232190.js';
|
|
24
26
|
import { p as prompts } from './vendor-index.405e58ef.js';
|
|
25
27
|
|
|
26
|
-
var version = "0.12.
|
|
28
|
+
var version = "0.12.7";
|
|
27
29
|
|
|
28
30
|
function stripFinalNewline(input) {
|
|
29
31
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -8030,6 +8032,7 @@ var __spreadValues$5 = (a, b) => {
|
|
|
8030
8032
|
return a;
|
|
8031
8033
|
};
|
|
8032
8034
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
8035
|
+
const debugRequest = createDebug("vite-node:server:request");
|
|
8033
8036
|
const RealDate = Date;
|
|
8034
8037
|
class ViteNodeServer {
|
|
8035
8038
|
constructor(server, options = {}) {
|
|
@@ -8098,6 +8101,7 @@ class ViteNodeServer {
|
|
|
8098
8101
|
return result;
|
|
8099
8102
|
}
|
|
8100
8103
|
async _transformRequest(id) {
|
|
8104
|
+
debugRequest(id);
|
|
8101
8105
|
let result = null;
|
|
8102
8106
|
if (this.getTransformMode(id) === "web") {
|
|
8103
8107
|
result = await this.server.transformRequest(id);
|
|
@@ -8315,7 +8319,8 @@ const hookSpinnerMap = /* @__PURE__ */ new WeakMap();
|
|
|
8315
8319
|
const pointer = picocolors.exports.yellow(F_POINTER);
|
|
8316
8320
|
const skipped = picocolors.exports.dim(picocolors.exports.gray(F_DOWN));
|
|
8317
8321
|
function getCols(delta = 0) {
|
|
8318
|
-
|
|
8322
|
+
var _a;
|
|
8323
|
+
let length = (_a = process.stdout) == null ? void 0 : _a.columns;
|
|
8319
8324
|
if (!length || isNaN(length))
|
|
8320
8325
|
length = 30;
|
|
8321
8326
|
return Math.max(length + delta, 0);
|
|
@@ -8446,6 +8451,7 @@ function elegantSpinner() {
|
|
|
8446
8451
|
};
|
|
8447
8452
|
}
|
|
8448
8453
|
|
|
8454
|
+
var _a;
|
|
8449
8455
|
const BADGE_PADDING = " ";
|
|
8450
8456
|
const HELP_HINT = `${picocolors.exports.dim("press ")}${picocolors.exports.bold("h")}${picocolors.exports.dim(" to show help")}`;
|
|
8451
8457
|
const HELP_UPDATE_SNAP = picocolors.exports.dim("press ") + picocolors.exports.bold(picocolors.exports.yellow("u")) + picocolors.exports.dim(" to update snapshot");
|
|
@@ -8459,19 +8465,19 @@ class BaseReporter {
|
|
|
8459
8465
|
constructor() {
|
|
8460
8466
|
this.start = 0;
|
|
8461
8467
|
this.end = 0;
|
|
8462
|
-
this.isTTY = process.stdout.isTTY && !process.env.CI;
|
|
8468
|
+
this.isTTY = isNode && ((_a = process.stdout) == null ? void 0 : _a.isTTY) && !process.env.CI;
|
|
8463
8469
|
this.ctx = void 0;
|
|
8464
8470
|
this.registerUnhandledRejection();
|
|
8465
8471
|
}
|
|
8466
8472
|
onInit(ctx) {
|
|
8467
|
-
var
|
|
8473
|
+
var _a2, _b;
|
|
8468
8474
|
this.ctx = ctx;
|
|
8469
8475
|
this.ctx.log();
|
|
8470
8476
|
const versionTest = this.ctx.config.watch ? picocolors.exports.blue(`v${version}`) : picocolors.exports.cyan(`v${version}`);
|
|
8471
8477
|
const mode = this.ctx.config.watch ? picocolors.exports.blue(" DEV ") : picocolors.exports.cyan(" RUN ");
|
|
8472
8478
|
this.ctx.log(`${picocolors.exports.inverse(picocolors.exports.bold(mode))} ${versionTest} ${picocolors.exports.gray(this.ctx.config.root)}`);
|
|
8473
8479
|
if (this.ctx.config.ui)
|
|
8474
|
-
this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((
|
|
8480
|
+
this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` UI started at http://${((_a2 = this.ctx.config.api) == null ? void 0 : _a2.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.server.config.server.port}`)}`)));
|
|
8475
8481
|
else if (this.ctx.config.api)
|
|
8476
8482
|
this.ctx.log(picocolors.exports.dim(picocolors.exports.green(` API started at http://${((_b = this.ctx.config.api) == null ? void 0 : _b.host) || "localhost"}:${picocolors.exports.bold(`${this.ctx.config.api.port}`)}`)));
|
|
8477
8483
|
this.ctx.log();
|
|
@@ -8497,16 +8503,16 @@ Please, resolve all the errors to make sure your tests are not affected.`));
|
|
|
8497
8503
|
}
|
|
8498
8504
|
}
|
|
8499
8505
|
onTaskUpdate(packs) {
|
|
8500
|
-
var
|
|
8506
|
+
var _a2, _b, _c;
|
|
8501
8507
|
if (this.isTTY)
|
|
8502
8508
|
return;
|
|
8503
8509
|
for (const pack of packs) {
|
|
8504
8510
|
const task = this.ctx.state.idMap.get(pack[0]);
|
|
8505
|
-
if (task && "filepath" in task && ((
|
|
8511
|
+
if (task && "filepath" in task && ((_a2 = task.result) == null ? void 0 : _a2.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
|
|
8506
8512
|
const tests = getTests(task);
|
|
8507
8513
|
const failed = tests.filter((t) => {
|
|
8508
|
-
var
|
|
8509
|
-
return ((
|
|
8514
|
+
var _a3;
|
|
8515
|
+
return ((_a3 = t.result) == null ? void 0 : _a3.state) === "fail";
|
|
8510
8516
|
});
|
|
8511
8517
|
const skipped = tests.filter((t) => t.mode === "skip" || t.mode === "todo");
|
|
8512
8518
|
let state = picocolors.exports.dim(`${tests.length} test${tests.length > 1 ? "s" : ""}`);
|
|
@@ -8562,10 +8568,10 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8562
8568
|
`);
|
|
8563
8569
|
}
|
|
8564
8570
|
shouldLog(log) {
|
|
8565
|
-
var
|
|
8571
|
+
var _a2, _b;
|
|
8566
8572
|
if (this.ctx.config.silent)
|
|
8567
8573
|
return false;
|
|
8568
|
-
const shouldIgnore = (_b = (
|
|
8574
|
+
const shouldIgnore = (_b = (_a2 = this.ctx.config).onConsoleLog) == null ? void 0 : _b.call(_a2, log.content, log.type);
|
|
8569
8575
|
if (shouldIgnore === false)
|
|
8570
8576
|
return shouldIgnore;
|
|
8571
8577
|
return true;
|
|
@@ -8577,12 +8583,12 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8577
8583
|
const suites = getSuites(files);
|
|
8578
8584
|
const tests = getTests(files);
|
|
8579
8585
|
const failedSuites = suites.filter((i) => {
|
|
8580
|
-
var
|
|
8581
|
-
return (
|
|
8586
|
+
var _a2;
|
|
8587
|
+
return (_a2 = i.result) == null ? void 0 : _a2.error;
|
|
8582
8588
|
});
|
|
8583
8589
|
const failedTests = tests.filter((i) => {
|
|
8584
|
-
var
|
|
8585
|
-
return ((
|
|
8590
|
+
var _a2;
|
|
8591
|
+
return ((_a2 = i.result) == null ? void 0 : _a2.state) === "fail";
|
|
8586
8592
|
});
|
|
8587
8593
|
const failedTotal = failedSuites.length + failedTests.length;
|
|
8588
8594
|
let current = 1;
|
|
@@ -8600,8 +8606,8 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8600
8606
|
}
|
|
8601
8607
|
const executionTime = this.end - this.start;
|
|
8602
8608
|
const threadTime = files.reduce((acc, test) => {
|
|
8603
|
-
var
|
|
8604
|
-
return acc + Math.max(0, ((
|
|
8609
|
+
var _a2;
|
|
8610
|
+
return acc + Math.max(0, ((_a2 = test.result) == null ? void 0 : _a2.duration) || 0) + Math.max(0, test.collectDuration || 0);
|
|
8605
8611
|
}, 0);
|
|
8606
8612
|
const padTitle = (str) => picocolors.exports.dim(`${str.padStart(10)} `);
|
|
8607
8613
|
const time = (time2) => {
|
|
@@ -8624,13 +8630,13 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8624
8630
|
this.ctx.log();
|
|
8625
8631
|
}
|
|
8626
8632
|
async printTaskErrors(tasks, errorDivider) {
|
|
8627
|
-
var
|
|
8633
|
+
var _a2;
|
|
8628
8634
|
const errorsQueue = [];
|
|
8629
8635
|
for (const task of tasks) {
|
|
8630
|
-
const error = (
|
|
8636
|
+
const error = (_a2 = task.result) == null ? void 0 : _a2.error;
|
|
8631
8637
|
const errorItem = (error == null ? void 0 : error.stackStr) && errorsQueue.find((i) => {
|
|
8632
|
-
var
|
|
8633
|
-
return ((
|
|
8638
|
+
var _a3;
|
|
8639
|
+
return ((_a3 = i[0]) == null ? void 0 : _a3.stackStr) === error.stackStr;
|
|
8634
8640
|
});
|
|
8635
8641
|
if (errorItem)
|
|
8636
8642
|
errorItem[1].push(task);
|
|
@@ -8647,6 +8653,7 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8647
8653
|
}
|
|
8648
8654
|
await this.ctx.printError(error);
|
|
8649
8655
|
errorDivider();
|
|
8656
|
+
await Promise.resolve();
|
|
8650
8657
|
}
|
|
8651
8658
|
}
|
|
8652
8659
|
registerUnhandledRejection() {
|
|
@@ -10022,7 +10029,7 @@ function resolveConfig(options, viteConfig) {
|
|
|
10022
10029
|
resolved.maxThreads = parseInt(process.env.VITEST_MAX_THREADS);
|
|
10023
10030
|
if (process.env.VITEST_MIN_THREADS)
|
|
10024
10031
|
resolved.minThreads = parseInt(process.env.VITEST_MIN_THREADS);
|
|
10025
|
-
resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) =>
|
|
10032
|
+
resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => normalize(resolveModule(file, { paths: [resolved.root] })));
|
|
10026
10033
|
resolved.api = resolveApiConfig(options);
|
|
10027
10034
|
if (options.related)
|
|
10028
10035
|
resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
|
|
@@ -10077,27 +10084,27 @@ function printErrorType(type, ctx) {
|
|
|
10077
10084
|
ctx.error(`
|
|
10078
10085
|
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` ${type} `))))}`);
|
|
10079
10086
|
}
|
|
10087
|
+
const skipErrorProperties = [
|
|
10088
|
+
"message",
|
|
10089
|
+
"name",
|
|
10090
|
+
"nameStr",
|
|
10091
|
+
"stack",
|
|
10092
|
+
"cause",
|
|
10093
|
+
"stacks",
|
|
10094
|
+
"stackStr",
|
|
10095
|
+
"type",
|
|
10096
|
+
"showDiff",
|
|
10097
|
+
"actual",
|
|
10098
|
+
"expected",
|
|
10099
|
+
"constructor",
|
|
10100
|
+
"toString"
|
|
10101
|
+
];
|
|
10080
10102
|
function getErrorProperties(e) {
|
|
10081
10103
|
const errorObject = /* @__PURE__ */ Object.create(null);
|
|
10082
10104
|
if (e.name === "AssertionError")
|
|
10083
10105
|
return errorObject;
|
|
10084
|
-
const skip = [
|
|
10085
|
-
"message",
|
|
10086
|
-
"name",
|
|
10087
|
-
"nameStr",
|
|
10088
|
-
"stack",
|
|
10089
|
-
"cause",
|
|
10090
|
-
"stacks",
|
|
10091
|
-
"stackStr",
|
|
10092
|
-
"type",
|
|
10093
|
-
"showDiff",
|
|
10094
|
-
"actual",
|
|
10095
|
-
"expected",
|
|
10096
|
-
"constructor",
|
|
10097
|
-
"toString"
|
|
10098
|
-
];
|
|
10099
10106
|
for (const key of Object.getOwnPropertyNames(e)) {
|
|
10100
|
-
if (!
|
|
10107
|
+
if (!skipErrorProperties.includes(key))
|
|
10101
10108
|
errorObject[key] = e[key];
|
|
10102
10109
|
}
|
|
10103
10110
|
return errorObject;
|
|
@@ -10115,7 +10122,7 @@ function handleImportOutsideModuleError(stack, ctx) {
|
|
|
10115
10122
|
name = name.split("/").slice(0, 2).join("/");
|
|
10116
10123
|
else
|
|
10117
10124
|
name = name.split("/")[0];
|
|
10118
|
-
ctx.
|
|
10125
|
+
ctx.error(picocolors.exports.yellow(`Module ${path} seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package ${picocolors.exports.bold(`"${name}"`)} asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
|
|
10119
10126
|
|
|
10120
10127
|
As a temporary workaround you can try to inline the package by updating your config:
|
|
10121
10128
|
|
|
@@ -10159,12 +10166,13 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
|
10159
10166
|
}
|
|
10160
10167
|
}
|
|
10161
10168
|
function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
10169
|
+
var _a;
|
|
10162
10170
|
start = posToNumber(source, start);
|
|
10163
10171
|
end = end || start;
|
|
10164
10172
|
const lines = source.split(lineSplitRE);
|
|
10165
10173
|
let count = 0;
|
|
10166
10174
|
let res = [];
|
|
10167
|
-
const columns = process.stdout.columns || 80;
|
|
10175
|
+
const columns = ((_a = process.stdout) == null ? void 0 : _a.columns) || 80;
|
|
10168
10176
|
function lineNo(no = "") {
|
|
10169
10177
|
return picocolors.exports.gray(`${String(no).padStart(3, " ")}| `);
|
|
10170
10178
|
}
|
|
@@ -10466,9 +10474,10 @@ class Vitest {
|
|
|
10466
10474
|
this.console.error(...args);
|
|
10467
10475
|
}
|
|
10468
10476
|
clearScreen() {
|
|
10477
|
+
var _a;
|
|
10469
10478
|
if (this.server.config.clearScreen === false)
|
|
10470
10479
|
return;
|
|
10471
|
-
const repeatCount = process.stdout.rows - 2;
|
|
10480
|
+
const repeatCount = (((_a = process.stdout) == null ? void 0 : _a.rows) ?? 0) - 2;
|
|
10472
10481
|
const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
|
|
10473
10482
|
this.console.log(blank);
|
|
10474
10483
|
readline.cursorTo(process.stdout, 0, 0);
|
|
@@ -10912,12 +10921,13 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10912
10921
|
}
|
|
10913
10922
|
}
|
|
10914
10923
|
options.defines = defines;
|
|
10915
|
-
|
|
10924
|
+
const open = preOptions.ui && preOptions.open ? preOptions.uiBase ?? "/__vitest__/" : void 0;
|
|
10925
|
+
const config = {
|
|
10916
10926
|
resolve: {
|
|
10917
10927
|
mainFields: []
|
|
10918
10928
|
},
|
|
10919
10929
|
server: __spreadProps(__spreadValues({}, preOptions.api), {
|
|
10920
|
-
open
|
|
10930
|
+
open,
|
|
10921
10931
|
preTransformRequests: false
|
|
10922
10932
|
}),
|
|
10923
10933
|
cacheDir: void 0,
|
|
@@ -10926,6 +10936,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10926
10936
|
entries: []
|
|
10927
10937
|
}
|
|
10928
10938
|
};
|
|
10939
|
+
return config;
|
|
10929
10940
|
},
|
|
10930
10941
|
async configResolved(viteConfig) {
|
|
10931
10942
|
var _b, _c, _d, _e;
|
|
@@ -10947,7 +10958,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10947
10958
|
await ctx.setServer(options, server);
|
|
10948
10959
|
haveStarted = true;
|
|
10949
10960
|
if (options.api && options.watch)
|
|
10950
|
-
(await import('./chunk-api-setup.
|
|
10961
|
+
(await import('./chunk-api-setup.2f2df7e0.js')).setup(ctx);
|
|
10951
10962
|
if (!options.watch)
|
|
10952
10963
|
await server.watcher.close();
|
|
10953
10964
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { k as isAbsolute$2, h as resolve, j as join$2,
|
|
4
|
+
import { k as isAbsolute$2, h as resolve, j as join$2, C as extname$2, d as dirname$2 } from './chunk-utils-global.2fab7e5c.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
|
8
8
|
import { format as format$2, inspect } from 'util';
|
|
9
|
+
import createDebug from 'debug';
|
|
9
10
|
|
|
10
11
|
/*---------------------------------------------------------------------------------------------
|
|
11
12
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8875,6 +8876,8 @@ async function withInlineSourcemap(result) {
|
|
|
8875
8876
|
return result;
|
|
8876
8877
|
}
|
|
8877
8878
|
|
|
8879
|
+
const debugExecute = createDebug("vite-node:client:execute");
|
|
8880
|
+
const debugNative = createDebug("vite-node:client:native");
|
|
8878
8881
|
const DEFAULT_REQUEST_STUBS = {
|
|
8879
8882
|
"/@vite/client": {
|
|
8880
8883
|
injectQuery: (id) => id,
|
|
@@ -8986,6 +8989,7 @@ ${getStack()}`), 2e3);
|
|
|
8986
8989
|
return requestStubs[id];
|
|
8987
8990
|
let { code: transformed, externalize } = await this.options.fetchModule(id);
|
|
8988
8991
|
if (externalize) {
|
|
8992
|
+
debugNative(externalize);
|
|
8989
8993
|
const mod = await this.interopedImport(externalize);
|
|
8990
8994
|
this.moduleCache.set(fsPath, { exports: mod });
|
|
8991
8995
|
return mod;
|
|
@@ -9019,6 +9023,7 @@ ${getStack()}`), 2e3);
|
|
|
9019
9023
|
__filename,
|
|
9020
9024
|
__dirname: dirname$2(__filename)
|
|
9021
9025
|
});
|
|
9026
|
+
debugExecute(__filename);
|
|
9022
9027
|
if (transformed[0] === "#")
|
|
9023
9028
|
transformed = transformed.replace(/^\#\!.*/, (s) => " ".repeat(s.length));
|
|
9024
9029
|
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(",")})=>{{${transformed}
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-utils-global.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-utils-global.2fab7e5c.js';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0aac0c8e.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
7
|
import 'buffer';
|
|
8
8
|
import 'child_process';
|
|
9
9
|
import 'process';
|
|
10
|
-
import './vendor-index.
|
|
10
|
+
import './vendor-index.6c69a0a8.js';
|
|
11
11
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
12
|
import 'fs';
|
|
13
13
|
import 'assert';
|
|
@@ -16,17 +16,18 @@ import 'util';
|
|
|
16
16
|
import 'url';
|
|
17
17
|
import 'os';
|
|
18
18
|
import 'vite';
|
|
19
|
-
import './chunk-constants.
|
|
19
|
+
import './chunk-constants.3570739f.js';
|
|
20
20
|
import 'readline';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
21
|
+
import './chunk-vite-node-utils.9975fd9e.js';
|
|
22
22
|
import 'module';
|
|
23
23
|
import 'vm';
|
|
24
|
-
import '
|
|
24
|
+
import 'debug';
|
|
25
|
+
import './chunk-defaults.7d81a6ca.js';
|
|
25
26
|
import 'worker_threads';
|
|
26
27
|
import 'tinypool';
|
|
27
28
|
import 'perf_hooks';
|
|
28
|
-
import './chunk-utils-timers.
|
|
29
|
-
import './chunk-magic-string.
|
|
29
|
+
import './chunk-utils-timers.da6ac0a6.js';
|
|
30
|
+
import './chunk-magic-string.41232190.js';
|
|
30
31
|
import './vendor-index.405e58ef.js';
|
|
31
32
|
|
|
32
33
|
function toArr(any) {
|
|
@@ -643,7 +644,7 @@ class CAC extends EventEmitter {
|
|
|
643
644
|
const cac = (name = "") => new CAC(name);
|
|
644
645
|
|
|
645
646
|
const cli = cac("vitest");
|
|
646
|
-
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--
|
|
647
|
+
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
647
648
|
cli.command("run [...filters]").action(run);
|
|
648
649
|
cli.command("related [...filters]").action(runRelated);
|
|
649
650
|
cli.command("watch [...filters]").action(start);
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { UserConfig as UserConfig$2 } from 'vite';
|
|
1
|
+
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
|
+
export { ConfigEnv } from 'vite';
|
|
2
3
|
import { UserConfig as UserConfig$1, ResolvedC8Options } from 'vitest';
|
|
3
4
|
|
|
4
5
|
// Type definitions for @sinonjs/fake-timers 8.1
|
|
@@ -98,6 +99,8 @@ interface UserConfig extends UserConfig$2 {
|
|
|
98
99
|
test?: UserConfig$2['test'];
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
declare
|
|
102
|
+
declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
103
|
+
declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
104
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
102
105
|
|
|
103
|
-
export { UserConfig, configDefaults, defineConfig };
|
|
106
|
+
export { UserConfig, UserConfigExport, UserConfigFn, configDefaults, defineConfig };
|
package/dist/entry.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
export { r as run } from './vendor-entry.
|
|
1
|
+
export { r as run } from './vendor-entry.7d6cc1fd.js';
|
|
2
2
|
import 'fs';
|
|
3
|
-
import './chunk-utils-global.
|
|
3
|
+
import './chunk-utils-global.2fab7e5c.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import '
|
|
8
|
-
import 'stream';
|
|
9
|
-
import './chunk-runtime-chain.f8567c17.js';
|
|
7
|
+
import './chunk-runtime-chain.5021a6b6.js';
|
|
10
8
|
import 'chai';
|
|
11
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
13
|
-
import './chunk-utils-timers.
|
|
10
|
+
import './chunk-runtime-rpc.47bae3f9.js';
|
|
11
|
+
import './chunk-utils-timers.da6ac0a6.js';
|
|
14
12
|
import './chunk-integrations-spy.bee66426.js';
|
|
15
13
|
import 'tinyspy';
|
|
16
14
|
import 'util';
|
|
17
|
-
import './chunk-defaults.
|
|
15
|
+
import './chunk-defaults.7d81a6ca.js';
|
|
18
16
|
import 'module';
|
|
19
17
|
import 'url';
|
|
20
|
-
import 'crypto';
|