vitest 0.18.1 → 0.20.0
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/LICENSE.md +5 -5
- package/dist/browser.d.ts +1890 -0
- package/dist/browser.mjs +22 -0
- package/dist/{chunk-api-setup.9d3f7670.mjs → chunk-api-setup.7c4c8879.mjs} +24 -6
- package/dist/{chunk-constants.d4406290.mjs → chunk-constants.16825f0c.mjs} +5 -4
- package/dist/{chunk-env-node.bbba78e5.mjs → chunk-defaults.1c51d585.mjs} +461 -457
- package/dist/{chunk-install-pkg.2dcb2c04.mjs → chunk-install-pkg.6c6dc0c2.mjs} +11 -10
- package/dist/chunk-integrations-globals.56a11010.mjs +26 -0
- package/dist/{chunk-utils-global.0a7416cf.mjs → chunk-mock-date.9160e13b.mjs} +16 -41
- package/dist/chunk-node-git.43dbdd42.mjs +1139 -0
- package/dist/chunk-runtime-chain.b6c2cdbc.mjs +2041 -0
- package/dist/chunk-runtime-error.0aa0dc06.mjs +648 -0
- package/dist/{chunk-runtime-chain.b60d57da.mjs → chunk-runtime-hooks.3ee34848.mjs} +14 -2014
- package/dist/{chunk-runtime-mocker.1d853e3a.mjs → chunk-runtime-mocker.0a8f7c5e.mjs} +23 -17
- package/dist/{chunk-runtime-rpc.9d1f4c48.mjs → chunk-runtime-rpc.dbf0b31d.mjs} +3 -1
- package/dist/chunk-utils-global.fa20c2f6.mjs +5 -0
- package/dist/{chunk-utils-source-map.c03f8bc4.mjs → chunk-utils-source-map.8198ebd9.mjs} +2 -2
- package/dist/chunk-utils-timers.b48455ed.mjs +27 -0
- package/dist/chunk-vite-node-client.a247c2c2.mjs +320 -0
- package/dist/chunk-vite-node-debug.c5887932.mjs +76 -0
- package/dist/{chunk-vite-node-externalize.6956d2d9.mjs → chunk-vite-node-externalize.2e90dadf.mjs} +165 -1182
- package/dist/{chunk-vite-node-utils.8077cd3c.mjs → chunk-vite-node-utils.9dfd1e3f.mjs} +4 -312
- package/dist/cli.mjs +10 -10
- package/dist/config.cjs +6 -3
- package/dist/config.d.ts +2 -0
- package/dist/config.mjs +6 -3
- package/dist/entry.mjs +17 -598
- package/dist/index.d.ts +81 -6
- package/dist/index.mjs +10 -5
- package/dist/loader.mjs +35 -0
- package/dist/node.d.ts +71 -4
- package/dist/node.mjs +13 -12
- package/dist/suite.mjs +15 -0
- package/dist/vendor-index.61438b77.mjs +335 -0
- package/dist/{vendor-index.4bf9c627.mjs → vendor-index.62ce5c33.mjs} +11 -343
- package/dist/worker.mjs +9 -6
- package/package.json +12 -4
- package/dist/chunk-integrations-globals.00b6e1ad.mjs +0 -23
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { builtinModules
|
|
2
|
-
import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'url';
|
|
3
|
-
import vm from 'vm';
|
|
4
|
-
import { q as resolve$1, d as dirname, t as isAbsolute$1, L as extname$1 } from './chunk-utils-global.0a7416cf.mjs';
|
|
1
|
+
import { builtinModules } from 'module';
|
|
5
2
|
import path from 'path';
|
|
3
|
+
import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'url';
|
|
6
4
|
import fs, { promises, statSync, existsSync, realpathSync, Stats } from 'fs';
|
|
7
5
|
import assert from 'assert';
|
|
8
6
|
import { format, inspect } from 'util';
|
|
9
|
-
import
|
|
7
|
+
import { y as resolve$1 } from './chunk-mock-date.9160e13b.mjs';
|
|
10
8
|
|
|
11
9
|
function normalizeWindowsPath(input = "") {
|
|
12
10
|
if (!input.includes("\\")) {
|
|
@@ -1113,310 +1111,4 @@ function toArray(array) {
|
|
|
1113
1111
|
return [array];
|
|
1114
1112
|
}
|
|
1115
1113
|
|
|
1116
|
-
|
|
1117
|
-
const debugNative = createDebug("vite-node:client:native");
|
|
1118
|
-
const DEFAULT_REQUEST_STUBS = {
|
|
1119
|
-
"/@vite/client": {
|
|
1120
|
-
injectQuery: (id) => id,
|
|
1121
|
-
createHotContext() {
|
|
1122
|
-
return {
|
|
1123
|
-
accept: () => {
|
|
1124
|
-
},
|
|
1125
|
-
prune: () => {
|
|
1126
|
-
},
|
|
1127
|
-
dispose: () => {
|
|
1128
|
-
},
|
|
1129
|
-
decline: () => {
|
|
1130
|
-
},
|
|
1131
|
-
invalidate: () => {
|
|
1132
|
-
},
|
|
1133
|
-
on: () => {
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
},
|
|
1137
|
-
updateStyle() {
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
class ModuleCacheMap extends Map {
|
|
1142
|
-
normalizePath(fsPath) {
|
|
1143
|
-
return normalizeModuleId(fsPath);
|
|
1144
|
-
}
|
|
1145
|
-
set(fsPath, mod) {
|
|
1146
|
-
fsPath = this.normalizePath(fsPath);
|
|
1147
|
-
if (!super.has(fsPath))
|
|
1148
|
-
super.set(fsPath, mod);
|
|
1149
|
-
else
|
|
1150
|
-
Object.assign(super.get(fsPath), mod);
|
|
1151
|
-
return this;
|
|
1152
|
-
}
|
|
1153
|
-
get(fsPath) {
|
|
1154
|
-
fsPath = this.normalizePath(fsPath);
|
|
1155
|
-
return super.get(fsPath);
|
|
1156
|
-
}
|
|
1157
|
-
delete(fsPath) {
|
|
1158
|
-
fsPath = this.normalizePath(fsPath);
|
|
1159
|
-
return super.delete(fsPath);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
class ViteNodeRunner {
|
|
1163
|
-
constructor(options) {
|
|
1164
|
-
this.options = options;
|
|
1165
|
-
this.root = options.root ?? process.cwd();
|
|
1166
|
-
this.moduleCache = options.moduleCache ?? new ModuleCacheMap();
|
|
1167
|
-
this.debug = options.debug ?? (typeof process !== "undefined" ? !!process.env.VITE_NODE_DEBUG : false);
|
|
1168
|
-
}
|
|
1169
|
-
async executeFile(file) {
|
|
1170
|
-
return await this.cachedRequest(`/@fs/${slash(resolve$1(file))}`, []);
|
|
1171
|
-
}
|
|
1172
|
-
async executeId(id) {
|
|
1173
|
-
return await this.cachedRequest(id, []);
|
|
1174
|
-
}
|
|
1175
|
-
async cachedRequest(rawId, callstack) {
|
|
1176
|
-
var _a, _b, _c, _d;
|
|
1177
|
-
const id = normalizeRequestId(rawId, this.options.base);
|
|
1178
|
-
const fsPath = toFilePath(id, this.root);
|
|
1179
|
-
if (callstack.includes(fsPath) && ((_a = this.moduleCache.get(fsPath)) == null ? void 0 : _a.exports))
|
|
1180
|
-
return (_b = this.moduleCache.get(fsPath)) == null ? void 0 : _b.exports;
|
|
1181
|
-
if ((_c = this.moduleCache.get(fsPath)) == null ? void 0 : _c.promise)
|
|
1182
|
-
return (_d = this.moduleCache.get(fsPath)) == null ? void 0 : _d.promise;
|
|
1183
|
-
const promise = this.directRequest(id, fsPath, callstack);
|
|
1184
|
-
this.moduleCache.set(fsPath, { promise });
|
|
1185
|
-
return await promise;
|
|
1186
|
-
}
|
|
1187
|
-
async directRequest(id, fsPath, _callstack) {
|
|
1188
|
-
const callstack = [..._callstack, fsPath];
|
|
1189
|
-
const request = async (dep) => {
|
|
1190
|
-
var _a;
|
|
1191
|
-
const fsPath2 = toFilePath(normalizeRequestId(dep, this.options.base), this.root);
|
|
1192
|
-
const getStack = () => {
|
|
1193
|
-
return `stack:
|
|
1194
|
-
${[...callstack, fsPath2].reverse().map((p) => `- ${p}`).join("\n")}`;
|
|
1195
|
-
};
|
|
1196
|
-
let debugTimer;
|
|
1197
|
-
if (this.debug)
|
|
1198
|
-
debugTimer = setTimeout(() => this.debugLog(() => `module ${fsPath2} takes over 2s to load.
|
|
1199
|
-
${getStack()}`), 2e3);
|
|
1200
|
-
try {
|
|
1201
|
-
if (callstack.includes(fsPath2)) {
|
|
1202
|
-
this.debugLog(() => `circular dependency, ${getStack()}`);
|
|
1203
|
-
const depExports = (_a = this.moduleCache.get(fsPath2)) == null ? void 0 : _a.exports;
|
|
1204
|
-
if (depExports)
|
|
1205
|
-
return depExports;
|
|
1206
|
-
throw new Error(`[vite-node] Failed to resolve circular dependency, ${getStack()}`);
|
|
1207
|
-
}
|
|
1208
|
-
const mod = await this.cachedRequest(dep, callstack);
|
|
1209
|
-
return mod;
|
|
1210
|
-
} finally {
|
|
1211
|
-
if (debugTimer)
|
|
1212
|
-
clearTimeout(debugTimer);
|
|
1213
|
-
}
|
|
1214
|
-
};
|
|
1215
|
-
Object.defineProperty(request, "callstack", { get: () => callstack });
|
|
1216
|
-
const resolveId = async (dep, callstackPosition = 1) => {
|
|
1217
|
-
if (this.options.resolveId && this.shouldResolveId(dep)) {
|
|
1218
|
-
let importer = callstack[callstack.length - callstackPosition];
|
|
1219
|
-
if (importer && importer.startsWith("mock:"))
|
|
1220
|
-
importer = importer.slice(5);
|
|
1221
|
-
const { id: id2 } = await this.options.resolveId(dep, importer) || {};
|
|
1222
|
-
dep = id2 && isAbsolute$1(id2) ? mergeSlashes(`/@fs/${id2}`) : id2 || dep;
|
|
1223
|
-
}
|
|
1224
|
-
return dep;
|
|
1225
|
-
};
|
|
1226
|
-
id = await resolveId(id, 2);
|
|
1227
|
-
const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
|
|
1228
|
-
if (id in requestStubs)
|
|
1229
|
-
return requestStubs[id];
|
|
1230
|
-
let { code: transformed, externalize } = await this.options.fetchModule(id);
|
|
1231
|
-
if (externalize) {
|
|
1232
|
-
debugNative(externalize);
|
|
1233
|
-
const mod = await this.interopedImport(externalize);
|
|
1234
|
-
this.moduleCache.set(fsPath, { exports: mod });
|
|
1235
|
-
return mod;
|
|
1236
|
-
}
|
|
1237
|
-
if (transformed == null)
|
|
1238
|
-
throw new Error(`[vite-node] Failed to load ${id}`);
|
|
1239
|
-
const url = pathToFileURL(fsPath).href;
|
|
1240
|
-
const meta = { url };
|
|
1241
|
-
const exports = /* @__PURE__ */ Object.create(null);
|
|
1242
|
-
exports[Symbol.toStringTag] = "Module";
|
|
1243
|
-
this.moduleCache.set(fsPath, { code: transformed, exports });
|
|
1244
|
-
const __filename = fileURLToPath$1(url);
|
|
1245
|
-
const moduleProxy = {
|
|
1246
|
-
set exports(value) {
|
|
1247
|
-
exportAll(exports, value);
|
|
1248
|
-
exports.default = value;
|
|
1249
|
-
},
|
|
1250
|
-
get exports() {
|
|
1251
|
-
return exports;
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
let hotContext;
|
|
1255
|
-
if (this.options.createHotContext) {
|
|
1256
|
-
Object.defineProperty(meta, "hot", {
|
|
1257
|
-
enumerable: true,
|
|
1258
|
-
get: () => {
|
|
1259
|
-
var _a, _b;
|
|
1260
|
-
hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? void 0 : _b.call(_a, this, `/@fs/${fsPath}`));
|
|
1261
|
-
return hotContext;
|
|
1262
|
-
}
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
const context = this.prepareContext({
|
|
1266
|
-
__vite_ssr_import__: request,
|
|
1267
|
-
__vite_ssr_dynamic_import__: request,
|
|
1268
|
-
__vite_ssr_exports__: exports,
|
|
1269
|
-
__vite_ssr_exportAll__: (obj) => exportAll(exports, obj),
|
|
1270
|
-
__vite_ssr_import_meta__: meta,
|
|
1271
|
-
__vitest_resolve_id__: resolveId,
|
|
1272
|
-
require: createRequire(url),
|
|
1273
|
-
exports,
|
|
1274
|
-
module: moduleProxy,
|
|
1275
|
-
__filename,
|
|
1276
|
-
__dirname: dirname(__filename)
|
|
1277
|
-
});
|
|
1278
|
-
debugExecute(__filename);
|
|
1279
|
-
if (transformed[0] === "#")
|
|
1280
|
-
transformed = transformed.replace(/^\#\!.*/, (s) => " ".repeat(s.length));
|
|
1281
|
-
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(",")})=>{{${transformed}
|
|
1282
|
-
}}`, {
|
|
1283
|
-
filename: fsPath,
|
|
1284
|
-
lineOffset: 0
|
|
1285
|
-
});
|
|
1286
|
-
await fn(...Object.values(context));
|
|
1287
|
-
return exports;
|
|
1288
|
-
}
|
|
1289
|
-
prepareContext(context) {
|
|
1290
|
-
return context;
|
|
1291
|
-
}
|
|
1292
|
-
shouldResolveId(dep) {
|
|
1293
|
-
if (isNodeBuiltin(dep) || dep in (this.options.requestStubs || DEFAULT_REQUEST_STUBS) || dep.startsWith("/@vite"))
|
|
1294
|
-
return false;
|
|
1295
|
-
return !isAbsolute$1(dep) || !extname$1(dep);
|
|
1296
|
-
}
|
|
1297
|
-
shouldInterop(path, mod) {
|
|
1298
|
-
if (this.options.interopDefault === false)
|
|
1299
|
-
return false;
|
|
1300
|
-
return !path.endsWith(".mjs") && "default" in mod;
|
|
1301
|
-
}
|
|
1302
|
-
async interopedImport(path) {
|
|
1303
|
-
const mod = await import(path);
|
|
1304
|
-
if (this.shouldInterop(path, mod)) {
|
|
1305
|
-
const tryDefault = this.hasNestedDefault(mod);
|
|
1306
|
-
return new Proxy(mod, {
|
|
1307
|
-
get: proxyMethod("get", tryDefault),
|
|
1308
|
-
set: proxyMethod("set", tryDefault),
|
|
1309
|
-
has: proxyMethod("has", tryDefault),
|
|
1310
|
-
deleteProperty: proxyMethod("deleteProperty", tryDefault)
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
return mod;
|
|
1314
|
-
}
|
|
1315
|
-
hasNestedDefault(target) {
|
|
1316
|
-
return "__esModule" in target && target.__esModule && "default" in target.default;
|
|
1317
|
-
}
|
|
1318
|
-
debugLog(msg) {
|
|
1319
|
-
if (this.debug)
|
|
1320
|
-
console.log(`[vite-node] ${msg()}`);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
function proxyMethod(name, tryDefault) {
|
|
1324
|
-
return function(target, key, ...args) {
|
|
1325
|
-
const result = Reflect[name](target, key, ...args);
|
|
1326
|
-
if (isPrimitive(target.default))
|
|
1327
|
-
return result;
|
|
1328
|
-
if (tryDefault && key === "default" || typeof result === "undefined")
|
|
1329
|
-
return Reflect[name](target.default, key, ...args);
|
|
1330
|
-
return result;
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
function exportAll(exports, sourceModule) {
|
|
1334
|
-
if (exports === sourceModule)
|
|
1335
|
-
return;
|
|
1336
|
-
for (const key in sourceModule) {
|
|
1337
|
-
if (key !== "default") {
|
|
1338
|
-
try {
|
|
1339
|
-
Object.defineProperty(exports, key, {
|
|
1340
|
-
enumerable: true,
|
|
1341
|
-
configurable: true,
|
|
1342
|
-
get() {
|
|
1343
|
-
return sourceModule[key];
|
|
1344
|
-
}
|
|
1345
|
-
});
|
|
1346
|
-
} catch (_err) {
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
const DEFAULT_TIMEOUT = 6e4;
|
|
1353
|
-
function createBirpc(functions, options) {
|
|
1354
|
-
const {
|
|
1355
|
-
post,
|
|
1356
|
-
on,
|
|
1357
|
-
eventNames = [],
|
|
1358
|
-
serialize = (i) => i,
|
|
1359
|
-
deserialize = (i) => i,
|
|
1360
|
-
timeout = DEFAULT_TIMEOUT
|
|
1361
|
-
} = options;
|
|
1362
|
-
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
1363
|
-
const rpc = new Proxy({}, {
|
|
1364
|
-
get(_, method) {
|
|
1365
|
-
const sendEvent = (...args) => {
|
|
1366
|
-
post(serialize({ m: method, a: args, t: "q" }));
|
|
1367
|
-
};
|
|
1368
|
-
if (eventNames.includes(method)) {
|
|
1369
|
-
sendEvent.asEvent = sendEvent;
|
|
1370
|
-
return sendEvent;
|
|
1371
|
-
}
|
|
1372
|
-
const sendCall = (...args) => {
|
|
1373
|
-
return new Promise((resolve, reject) => {
|
|
1374
|
-
const id = nanoid();
|
|
1375
|
-
rpcPromiseMap.set(id, { resolve, reject });
|
|
1376
|
-
post(serialize({ m: method, a: args, i: id, t: "q" }));
|
|
1377
|
-
if (timeout >= 0) {
|
|
1378
|
-
setTimeout(() => {
|
|
1379
|
-
reject(new Error(`[birpc] timeout on calling "${method}"`));
|
|
1380
|
-
rpcPromiseMap.delete(id);
|
|
1381
|
-
}, timeout);
|
|
1382
|
-
}
|
|
1383
|
-
});
|
|
1384
|
-
};
|
|
1385
|
-
sendCall.asEvent = sendEvent;
|
|
1386
|
-
return sendCall;
|
|
1387
|
-
}
|
|
1388
|
-
});
|
|
1389
|
-
on(async (data, ...extra) => {
|
|
1390
|
-
const msg = deserialize(data);
|
|
1391
|
-
if (msg.t === "q") {
|
|
1392
|
-
const { m: method, a: args } = msg;
|
|
1393
|
-
let result, error;
|
|
1394
|
-
try {
|
|
1395
|
-
result = await functions[method].apply(rpc, args);
|
|
1396
|
-
} catch (e) {
|
|
1397
|
-
error = e;
|
|
1398
|
-
}
|
|
1399
|
-
if (msg.i)
|
|
1400
|
-
post(serialize({ t: "s", i: msg.i, r: result, e: error }), ...extra);
|
|
1401
|
-
} else {
|
|
1402
|
-
const { i: ack, r: result, e: error } = msg;
|
|
1403
|
-
const promise = rpcPromiseMap.get(ack);
|
|
1404
|
-
if (error)
|
|
1405
|
-
promise?.reject(error);
|
|
1406
|
-
else
|
|
1407
|
-
promise?.resolve(result);
|
|
1408
|
-
rpcPromiseMap.delete(ack);
|
|
1409
|
-
}
|
|
1410
|
-
});
|
|
1411
|
-
return rpc;
|
|
1412
|
-
}
|
|
1413
|
-
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1414
|
-
function nanoid(size = 21) {
|
|
1415
|
-
let id = "";
|
|
1416
|
-
let i = size;
|
|
1417
|
-
while (i--)
|
|
1418
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1419
|
-
return id;
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
export { ModuleCacheMap as M, ViteNodeRunner as V, isValidNodeImport as a, toFilePath as b, createBirpc as c, isNodeBuiltin as i, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
|
1114
|
+
export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
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.2e90dadf.mjs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-defaults.1c51d585.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
13
|
+
import './chunk-constants.16825f0c.mjs';
|
|
14
14
|
import 'os';
|
|
15
15
|
import 'util';
|
|
16
16
|
import 'stream';
|
|
17
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
18
|
-
import './chunk-vite-node-
|
|
18
|
+
import './chunk-vite-node-client.a247c2c2.mjs';
|
|
19
19
|
import 'vm';
|
|
20
|
+
import './chunk-vite-node-utils.9dfd1e3f.mjs';
|
|
20
21
|
import 'assert';
|
|
21
22
|
import 'debug';
|
|
22
23
|
import 'worker_threads';
|
|
23
24
|
import 'tinypool';
|
|
24
25
|
import 'perf_hooks';
|
|
25
|
-
import './chunk-utils-source-map.
|
|
26
|
+
import './chunk-utils-source-map.8198ebd9.mjs';
|
|
27
|
+
import './chunk-utils-timers.b48455ed.mjs';
|
|
26
28
|
import 'crypto';
|
|
27
|
-
import '
|
|
28
|
-
import 'child_process';
|
|
29
|
-
import './vendor-index.4bf9c627.mjs';
|
|
29
|
+
import './vendor-index.61438b77.mjs';
|
|
30
30
|
import './chunk-magic-string.efe26975.mjs';
|
|
31
31
|
import 'readline';
|
|
32
32
|
import './vendor-index.de788b6a.mjs';
|
|
@@ -645,7 +645,7 @@ class CAC extends EventEmitter {
|
|
|
645
645
|
const cac = (name = "") => new CAC(name);
|
|
646
646
|
|
|
647
647
|
const cli = cac("vitest");
|
|
648
|
-
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 (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").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("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").help();
|
|
648
|
+
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 (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").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("--browser", "run tests in browser").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("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").help();
|
|
649
649
|
cli.command("run [...filters]").action(run);
|
|
650
650
|
cli.command("related [...filters]").action(runRelated);
|
|
651
651
|
cli.command("watch [...filters]").action(start);
|
package/dist/config.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
|
6
6
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
|
|
7
7
|
const defaultCoverageExcludes = [
|
|
8
8
|
"coverage/**",
|
|
9
|
+
"dist/**",
|
|
9
10
|
"packages/*/test{,s}/**",
|
|
10
11
|
"**/*.d.ts",
|
|
11
12
|
"cypress/**",
|
|
@@ -14,7 +15,7 @@ const defaultCoverageExcludes = [
|
|
|
14
15
|
"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}",
|
|
15
16
|
"**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}",
|
|
16
17
|
"**/__tests__/**",
|
|
17
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc}.config.{js,cjs,mjs,ts}",
|
|
18
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}",
|
|
18
19
|
"**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
|
|
19
20
|
];
|
|
20
21
|
const coverageConfigDefaults = {
|
|
@@ -24,7 +25,7 @@ const coverageConfigDefaults = {
|
|
|
24
25
|
reportsDirectory: "./coverage",
|
|
25
26
|
excludeNodeModules: true,
|
|
26
27
|
exclude: defaultCoverageExcludes,
|
|
27
|
-
reporter: ["text", "html"],
|
|
28
|
+
reporter: ["text", "html", "clover"],
|
|
28
29
|
allowExternal: false,
|
|
29
30
|
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
30
31
|
};
|
|
@@ -54,6 +55,7 @@ const config = {
|
|
|
54
55
|
exclude: defaultExclude,
|
|
55
56
|
testTimeout: 5e3,
|
|
56
57
|
hookTimeout: 1e4,
|
|
58
|
+
teardownTimeout: 1e3,
|
|
57
59
|
isolate: true,
|
|
58
60
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
59
61
|
forceRerunTriggers: [
|
|
@@ -73,7 +75,8 @@ const config = {
|
|
|
73
75
|
},
|
|
74
76
|
coverage: coverageConfigDefaults,
|
|
75
77
|
fakeTimers: fakeTimersDefaults,
|
|
76
|
-
maxConcurrency: 5
|
|
78
|
+
maxConcurrency: 5,
|
|
79
|
+
dangerouslyIgnoreUnhandledErrors: false
|
|
77
80
|
};
|
|
78
81
|
const configDefaults = Object.freeze(config);
|
|
79
82
|
|
package/dist/config.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ declare const config: {
|
|
|
81
81
|
exclude: string[];
|
|
82
82
|
testTimeout: number;
|
|
83
83
|
hookTimeout: number;
|
|
84
|
+
teardownTimeout: number;
|
|
84
85
|
isolate: boolean;
|
|
85
86
|
watchExclude: string[];
|
|
86
87
|
forceRerunTriggers: string[];
|
|
@@ -97,6 +98,7 @@ declare const config: {
|
|
|
97
98
|
coverage: ResolvedC8Options;
|
|
98
99
|
fakeTimers: FakeTimerInstallOpts;
|
|
99
100
|
maxConcurrency: number;
|
|
101
|
+
dangerouslyIgnoreUnhandledErrors: boolean;
|
|
100
102
|
};
|
|
101
103
|
declare const configDefaults: Required<Pick<UserConfig$1, keyof typeof config>>;
|
|
102
104
|
|
package/dist/config.mjs
CHANGED
|
@@ -2,6 +2,7 @@ const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
|
2
2
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
|
|
3
3
|
const defaultCoverageExcludes = [
|
|
4
4
|
"coverage/**",
|
|
5
|
+
"dist/**",
|
|
5
6
|
"packages/*/test{,s}/**",
|
|
6
7
|
"**/*.d.ts",
|
|
7
8
|
"cypress/**",
|
|
@@ -10,7 +11,7 @@ const defaultCoverageExcludes = [
|
|
|
10
11
|
"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}",
|
|
11
12
|
"**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}",
|
|
12
13
|
"**/__tests__/**",
|
|
13
|
-
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc}.config.{js,cjs,mjs,ts}",
|
|
14
|
+
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}",
|
|
14
15
|
"**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
|
|
15
16
|
];
|
|
16
17
|
const coverageConfigDefaults = {
|
|
@@ -20,7 +21,7 @@ const coverageConfigDefaults = {
|
|
|
20
21
|
reportsDirectory: "./coverage",
|
|
21
22
|
excludeNodeModules: true,
|
|
22
23
|
exclude: defaultCoverageExcludes,
|
|
23
|
-
reporter: ["text", "html"],
|
|
24
|
+
reporter: ["text", "html", "clover"],
|
|
24
25
|
allowExternal: false,
|
|
25
26
|
extension: [".js", ".cjs", ".mjs", ".ts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
26
27
|
};
|
|
@@ -50,6 +51,7 @@ const config = {
|
|
|
50
51
|
exclude: defaultExclude,
|
|
51
52
|
testTimeout: 5e3,
|
|
52
53
|
hookTimeout: 1e4,
|
|
54
|
+
teardownTimeout: 1e3,
|
|
53
55
|
isolate: true,
|
|
54
56
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
55
57
|
forceRerunTriggers: [
|
|
@@ -69,7 +71,8 @@ const config = {
|
|
|
69
71
|
},
|
|
70
72
|
coverage: coverageConfigDefaults,
|
|
71
73
|
fakeTimers: fakeTimersDefaults,
|
|
72
|
-
maxConcurrency: 5
|
|
74
|
+
maxConcurrency: 5,
|
|
75
|
+
dangerouslyIgnoreUnhandledErrors: false
|
|
73
76
|
};
|
|
74
77
|
const configDefaults = Object.freeze(config);
|
|
75
78
|
|