elit 3.6.4 → 3.6.5
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +8 -1
- package/dist/cli.cjs +246 -157
- package/dist/cli.mjs +246 -157
- package/dist/test-runtime.cjs +184 -141
- package/dist/test-runtime.js +193 -150
- package/dist/test-runtime.mjs +184 -141
- package/dist/test.cjs +143 -134
- package/dist/test.js +152 -143
- package/dist/test.mjs +143 -134
- package/package.json +1 -1
package/dist/test.js
CHANGED
|
@@ -431,7 +431,7 @@
|
|
|
431
431
|
|
|
432
432
|
// node_modules/esbuild/lib/main.js
|
|
433
433
|
var require_main = __commonJS({
|
|
434
|
-
"node_modules/esbuild/lib/main.js"(exports,
|
|
434
|
+
"node_modules/esbuild/lib/main.js"(exports, module) {
|
|
435
435
|
"use strict";
|
|
436
436
|
var __defProp2 = Object.defineProperty;
|
|
437
437
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -466,7 +466,7 @@
|
|
|
466
466
|
transformSync: () => transformSync2,
|
|
467
467
|
version: () => version
|
|
468
468
|
});
|
|
469
|
-
|
|
469
|
+
module.exports = __toCommonJS(node_exports);
|
|
470
470
|
function encodePacket(packet) {
|
|
471
471
|
let visit = (value) => {
|
|
472
472
|
if (value === null) {
|
|
@@ -2975,9 +2975,9 @@ error: ${text}`);
|
|
|
2975
2975
|
|
|
2976
2976
|
// node_modules/source-map/lib/url.js
|
|
2977
2977
|
var require_url = __commonJS({
|
|
2978
|
-
"node_modules/source-map/lib/url.js"(exports,
|
|
2978
|
+
"node_modules/source-map/lib/url.js"(exports, module) {
|
|
2979
2979
|
"use strict";
|
|
2980
|
-
|
|
2980
|
+
module.exports = typeof URL === "function" ? URL : __require("url").URL;
|
|
2981
2981
|
}
|
|
2982
2982
|
});
|
|
2983
2983
|
|
|
@@ -3760,11 +3760,11 @@ error: ${text}`);
|
|
|
3760
3760
|
|
|
3761
3761
|
// node_modules/source-map/lib/read-wasm.js
|
|
3762
3762
|
var require_read_wasm = __commonJS({
|
|
3763
|
-
"node_modules/source-map/lib/read-wasm.js"(exports,
|
|
3763
|
+
"node_modules/source-map/lib/read-wasm.js"(exports, module) {
|
|
3764
3764
|
"use strict";
|
|
3765
3765
|
var fs2 = __require("fs");
|
|
3766
3766
|
var path = __require("path");
|
|
3767
|
-
|
|
3767
|
+
module.exports = function readWasm() {
|
|
3768
3768
|
return new Promise((resolve3, reject) => {
|
|
3769
3769
|
const wasmPath = path.join(__dirname, "mappings.wasm");
|
|
3770
3770
|
fs2.readFile(wasmPath, null, (error, data) => {
|
|
@@ -3776,7 +3776,7 @@ error: ${text}`);
|
|
|
3776
3776
|
});
|
|
3777
3777
|
});
|
|
3778
3778
|
};
|
|
3779
|
-
|
|
3779
|
+
module.exports.initialize = (_) => {
|
|
3780
3780
|
console.debug(
|
|
3781
3781
|
"SourceMapConsumer.initialize is a no-op when running in node.js"
|
|
3782
3782
|
);
|
|
@@ -3786,7 +3786,7 @@ error: ${text}`);
|
|
|
3786
3786
|
|
|
3787
3787
|
// node_modules/source-map/lib/wasm.js
|
|
3788
3788
|
var require_wasm = __commonJS({
|
|
3789
|
-
"node_modules/source-map/lib/wasm.js"(exports,
|
|
3789
|
+
"node_modules/source-map/lib/wasm.js"(exports, module) {
|
|
3790
3790
|
"use strict";
|
|
3791
3791
|
var readWasm = require_read_wasm();
|
|
3792
3792
|
function Mapping() {
|
|
@@ -3799,7 +3799,7 @@ error: ${text}`);
|
|
|
3799
3799
|
this.name = null;
|
|
3800
3800
|
}
|
|
3801
3801
|
var cachedWasm = null;
|
|
3802
|
-
|
|
3802
|
+
module.exports = function wasm() {
|
|
3803
3803
|
if (cachedWasm) {
|
|
3804
3804
|
return cachedWasm;
|
|
3805
3805
|
}
|
|
@@ -7910,9 +7910,124 @@ ${fileEntries.join("")}
|
|
|
7910
7910
|
var currentTestFile = void 0;
|
|
7911
7911
|
var currentSourceMapConsumer = void 0;
|
|
7912
7912
|
var wrapperLineOffset = 0;
|
|
7913
|
+
var TEST_MODULE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs", ".json"];
|
|
7914
|
+
function resolveTestLoader(filePath) {
|
|
7915
|
+
return /\.(?:ts|tsx|mts|cts)$/i.test(filePath) ? "ts" : "js";
|
|
7916
|
+
}
|
|
7917
|
+
function createTestTransformOptions(filePath, format, sourcemap) {
|
|
7918
|
+
return {
|
|
7919
|
+
loader: resolveTestLoader(filePath),
|
|
7920
|
+
format,
|
|
7921
|
+
sourcemap,
|
|
7922
|
+
sourcefile: filePath,
|
|
7923
|
+
target: "es2020",
|
|
7924
|
+
tsconfigRaw: {
|
|
7925
|
+
compilerOptions: {
|
|
7926
|
+
jsx: "react",
|
|
7927
|
+
jsxFactory: "h",
|
|
7928
|
+
jsxFragmentFactory: "Fragment"
|
|
7929
|
+
}
|
|
7930
|
+
}
|
|
7931
|
+
};
|
|
7932
|
+
}
|
|
7933
|
+
function resolveExistingTestModulePath(basePath) {
|
|
7934
|
+
const nodePath = __require("path");
|
|
7935
|
+
if (existsSync(basePath) && statSync(basePath).isFile()) {
|
|
7936
|
+
return basePath;
|
|
7937
|
+
}
|
|
7938
|
+
for (const extension of TEST_MODULE_EXTENSIONS) {
|
|
7939
|
+
const candidatePath = `${basePath}${extension}`;
|
|
7940
|
+
if (existsSync(candidatePath) && statSync(candidatePath).isFile()) {
|
|
7941
|
+
return candidatePath;
|
|
7942
|
+
}
|
|
7943
|
+
}
|
|
7944
|
+
if (existsSync(basePath) && statSync(basePath).isDirectory()) {
|
|
7945
|
+
const packageJsonPath = nodePath.join(basePath, "package.json");
|
|
7946
|
+
if (existsSync(packageJsonPath) && statSync(packageJsonPath).isFile()) {
|
|
7947
|
+
try {
|
|
7948
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
7949
|
+
for (const candidateEntry of [packageJson.main, packageJson.module]) {
|
|
7950
|
+
if (typeof candidateEntry !== "string" || candidateEntry.trim().length === 0) {
|
|
7951
|
+
continue;
|
|
7952
|
+
}
|
|
7953
|
+
try {
|
|
7954
|
+
return resolveExistingTestModulePath(nodePath.resolve(basePath, candidateEntry));
|
|
7955
|
+
} catch {
|
|
7956
|
+
continue;
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7959
|
+
} catch {
|
|
7960
|
+
}
|
|
7961
|
+
}
|
|
7962
|
+
for (const extension of TEST_MODULE_EXTENSIONS) {
|
|
7963
|
+
const candidatePath = nodePath.join(basePath, `index${extension}`);
|
|
7964
|
+
if (existsSync(candidatePath) && statSync(candidatePath).isFile()) {
|
|
7965
|
+
return candidatePath;
|
|
7966
|
+
}
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
return basePath;
|
|
7970
|
+
}
|
|
7971
|
+
function resolveTestModulePath(fromFilePath, specifier) {
|
|
7972
|
+
if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
|
|
7973
|
+
return specifier;
|
|
7974
|
+
}
|
|
7975
|
+
const nodePath = __require("path");
|
|
7976
|
+
const basePath = specifier.startsWith(".") ? nodePath.resolve(dirname(fromFilePath), specifier) : specifier;
|
|
7977
|
+
return resolveExistingTestModulePath(basePath);
|
|
7978
|
+
}
|
|
7979
|
+
function shouldTranspileTestModule(filePath) {
|
|
7980
|
+
return /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/i.test(filePath);
|
|
7981
|
+
}
|
|
7982
|
+
function createTestModuleRequire(fromFilePath, moduleCache) {
|
|
7983
|
+
return (specifier) => {
|
|
7984
|
+
if (specifier.startsWith("elit/") || specifier === "elit") {
|
|
7985
|
+
return __require(specifier);
|
|
7986
|
+
}
|
|
7987
|
+
const resolvedPath = resolveTestModulePath(fromFilePath, specifier);
|
|
7988
|
+
if (resolvedPath === specifier) {
|
|
7989
|
+
return __require(specifier);
|
|
7990
|
+
}
|
|
7991
|
+
if (!existsSync(resolvedPath) || !statSync(resolvedPath).isFile()) {
|
|
7992
|
+
return __require(resolvedPath);
|
|
7993
|
+
}
|
|
7994
|
+
if (!shouldTranspileTestModule(resolvedPath)) {
|
|
7995
|
+
return __require(resolvedPath);
|
|
7996
|
+
}
|
|
7997
|
+
return loadTranspiledTestModule(resolvedPath, moduleCache);
|
|
7998
|
+
};
|
|
7999
|
+
}
|
|
8000
|
+
function loadTranspiledTestModule(modulePath, moduleCache) {
|
|
8001
|
+
const cached = moduleCache.get(modulePath);
|
|
8002
|
+
if (cached) {
|
|
8003
|
+
return cached.exports;
|
|
8004
|
+
}
|
|
8005
|
+
const source = readFileSync(modulePath, "utf-8");
|
|
8006
|
+
let transpiled;
|
|
8007
|
+
try {
|
|
8008
|
+
transpiled = (0, import_esbuild.transformSync)(source, createTestTransformOptions(modulePath, "cjs", false));
|
|
8009
|
+
} catch (error) {
|
|
8010
|
+
throw new Error(`Failed to transpile test dependency ${modulePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
8011
|
+
}
|
|
8012
|
+
const moduleRecord = { exports: {} };
|
|
8013
|
+
const moduleObj = { exports: moduleRecord.exports };
|
|
8014
|
+
moduleCache.set(modulePath, moduleRecord);
|
|
8015
|
+
try {
|
|
8016
|
+
const fn = new Function("module", "exports", "require", "__filename", "__dirname", transpiled.code);
|
|
8017
|
+
const requireFn = createTestModuleRequire(modulePath, moduleCache);
|
|
8018
|
+
fn(moduleObj, moduleObj.exports, requireFn, modulePath, dirname(modulePath));
|
|
8019
|
+
} catch (error) {
|
|
8020
|
+
throw new Error(`Failed to execute test dependency ${modulePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
8021
|
+
}
|
|
8022
|
+
moduleRecord.exports = moduleObj.exports;
|
|
8023
|
+
if (!modulePath.includes(".test.") && !modulePath.includes(".spec.")) {
|
|
8024
|
+
coveredFiles.add(modulePath);
|
|
8025
|
+
}
|
|
8026
|
+
return moduleRecord.exports;
|
|
8027
|
+
}
|
|
7913
8028
|
function createTestFunction(defaultTimeout = 5e3) {
|
|
7914
8029
|
const testFn = function(name, fn, timeout) {
|
|
7915
|
-
const
|
|
8030
|
+
const test = {
|
|
7916
8031
|
name,
|
|
7917
8032
|
fn,
|
|
7918
8033
|
skip: currentSuite.skip,
|
|
@@ -7921,10 +8036,10 @@ ${fileEntries.join("")}
|
|
|
7921
8036
|
timeout: timeout ?? defaultTimeout,
|
|
7922
8037
|
suite: currentSuite
|
|
7923
8038
|
};
|
|
7924
|
-
currentSuite.tests.push(
|
|
8039
|
+
currentSuite.tests.push(test);
|
|
7925
8040
|
};
|
|
7926
8041
|
testFn.skip = (name, fn, timeout) => {
|
|
7927
|
-
const
|
|
8042
|
+
const test = {
|
|
7928
8043
|
name,
|
|
7929
8044
|
fn,
|
|
7930
8045
|
skip: true,
|
|
@@ -7933,11 +8048,11 @@ ${fileEntries.join("")}
|
|
|
7933
8048
|
timeout: timeout ?? defaultTimeout,
|
|
7934
8049
|
suite: currentSuite
|
|
7935
8050
|
};
|
|
7936
|
-
currentSuite.tests.push(
|
|
8051
|
+
currentSuite.tests.push(test);
|
|
7937
8052
|
};
|
|
7938
8053
|
testFn.only = (name, fn, timeout) => {
|
|
7939
8054
|
hasOnly = true;
|
|
7940
|
-
const
|
|
8055
|
+
const test = {
|
|
7941
8056
|
name,
|
|
7942
8057
|
fn,
|
|
7943
8058
|
skip: false,
|
|
@@ -7946,10 +8061,10 @@ ${fileEntries.join("")}
|
|
|
7946
8061
|
timeout: timeout ?? defaultTimeout,
|
|
7947
8062
|
suite: currentSuite
|
|
7948
8063
|
};
|
|
7949
|
-
currentSuite.tests.push(
|
|
8064
|
+
currentSuite.tests.push(test);
|
|
7950
8065
|
};
|
|
7951
8066
|
testFn.todo = (name, fn, timeout) => {
|
|
7952
|
-
const
|
|
8067
|
+
const test = {
|
|
7953
8068
|
name,
|
|
7954
8069
|
fn,
|
|
7955
8070
|
skip: false,
|
|
@@ -7958,7 +8073,7 @@ ${fileEntries.join("")}
|
|
|
7958
8073
|
timeout: timeout ?? defaultTimeout,
|
|
7959
8074
|
suite: currentSuite
|
|
7960
8075
|
};
|
|
7961
|
-
currentSuite.tests.push(
|
|
8076
|
+
currentSuite.tests.push(test);
|
|
7962
8077
|
};
|
|
7963
8078
|
return testFn;
|
|
7964
8079
|
}
|
|
@@ -8524,29 +8639,7 @@ ${fileEntries.join("")}
|
|
|
8524
8639
|
try {
|
|
8525
8640
|
const source = await readFile(file, "utf-8");
|
|
8526
8641
|
const testFileDir = dirname(file);
|
|
8527
|
-
const
|
|
8528
|
-
const imports = {};
|
|
8529
|
-
let importIndex = 0;
|
|
8530
|
-
let codeWithoutImports = source.replace(importRegex, (_, named, path) => {
|
|
8531
|
-
const varName = `__import_${importIndex++}`;
|
|
8532
|
-
const trimmedNamed = named.trim();
|
|
8533
|
-
imports[varName] = { path, named: trimmedNamed };
|
|
8534
|
-
return `// ${trimmedNamed} import injected later
|
|
8535
|
-
`;
|
|
8536
|
-
});
|
|
8537
|
-
const result = (0, import_esbuild.transformSync)(codeWithoutImports, {
|
|
8538
|
-
loader: file.endsWith(".ts") || file.endsWith(".tsx") ? "ts" : "js",
|
|
8539
|
-
format: "iife",
|
|
8540
|
-
sourcemap: "inline",
|
|
8541
|
-
target: "es2020",
|
|
8542
|
-
tsconfigRaw: {
|
|
8543
|
-
compilerOptions: {
|
|
8544
|
-
jsx: "react",
|
|
8545
|
-
jsxFactory: "h",
|
|
8546
|
-
jsxFragmentFactory: "Fragment"
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
});
|
|
8642
|
+
const result = (0, import_esbuild.transformSync)(source, createTestTransformOptions(file, "cjs", "inline"));
|
|
8550
8643
|
let code = result.code;
|
|
8551
8644
|
const sourceMapMatch = code.match(/\/\/# sourceMappingURL=data:application\/json;base64,(.+)/);
|
|
8552
8645
|
if (sourceMapMatch) {
|
|
@@ -8557,99 +8650,15 @@ ${fileEntries.join("")}
|
|
|
8557
8650
|
} else {
|
|
8558
8651
|
currentSourceMapConsumer = void 0;
|
|
8559
8652
|
}
|
|
8560
|
-
|
|
8561
|
-
const importParamNames = [];
|
|
8562
|
-
const importAssignments = [];
|
|
8563
|
-
if (Object.keys(imports).length > 0) {
|
|
8564
|
-
for (const [, { path, named }] of Object.entries(imports)) {
|
|
8565
|
-
let resolvedPath = path;
|
|
8566
|
-
if (path.startsWith(".")) {
|
|
8567
|
-
const nodePath = __require("path");
|
|
8568
|
-
resolvedPath = nodePath.resolve(testFileDir, path);
|
|
8569
|
-
}
|
|
8570
|
-
if (!resolvedPath.endsWith(".ts") && !resolvedPath.endsWith(".js") && !resolvedPath.endsWith(".mjs") && !resolvedPath.endsWith(".cjs")) {
|
|
8571
|
-
resolvedPath += ".ts";
|
|
8572
|
-
}
|
|
8573
|
-
if (resolvedPath.endsWith(".ts")) {
|
|
8574
|
-
try {
|
|
8575
|
-
const importSource = await readFile(resolvedPath, "utf-8");
|
|
8576
|
-
const transpiled = (0, import_esbuild.transformSync)(importSource, {
|
|
8577
|
-
loader: "ts",
|
|
8578
|
-
format: "cjs",
|
|
8579
|
-
target: "es2020",
|
|
8580
|
-
tsconfigRaw: {
|
|
8581
|
-
compilerOptions: {
|
|
8582
|
-
jsx: "react",
|
|
8583
|
-
jsxFactory: "h",
|
|
8584
|
-
jsxFragmentFactory: "Fragment"
|
|
8585
|
-
}
|
|
8586
|
-
}
|
|
8587
|
-
});
|
|
8588
|
-
const moduleExports = {};
|
|
8589
|
-
const moduleObj = { exports: moduleExports };
|
|
8590
|
-
const fn2 = new Function("module", "exports", "require", "__filename", "__dirname", transpiled.code);
|
|
8591
|
-
const requireFn = (id) => {
|
|
8592
|
-
if (id.startsWith("elit/") || id === "elit") {
|
|
8593
|
-
return __require(id);
|
|
8594
|
-
}
|
|
8595
|
-
if (id.startsWith(".")) {
|
|
8596
|
-
const nodePath = __require("path");
|
|
8597
|
-
const absPath = nodePath.resolve(dirname(resolvedPath), id);
|
|
8598
|
-
return __require(absPath);
|
|
8599
|
-
}
|
|
8600
|
-
return __require(id);
|
|
8601
|
-
};
|
|
8602
|
-
fn2(moduleObj, moduleExports, requireFn, resolvedPath, dirname(resolvedPath));
|
|
8603
|
-
if (!resolvedPath.includes(".test.") && !resolvedPath.includes(".spec.")) {
|
|
8604
|
-
coveredFiles.add(resolvedPath);
|
|
8605
|
-
}
|
|
8606
|
-
let exportedValue = moduleObj.exports[named];
|
|
8607
|
-
if (exportedValue === void 0 && moduleObj.exports.default) {
|
|
8608
|
-
exportedValue = moduleObj.exports.default[named];
|
|
8609
|
-
}
|
|
8610
|
-
if (exportedValue === void 0 && typeof moduleObj.exports === "object") {
|
|
8611
|
-
exportedValue = moduleObj.exports[named];
|
|
8612
|
-
}
|
|
8613
|
-
const paramKey = `__import_${Math.random().toString(36).substring(2, 11)}`;
|
|
8614
|
-
importedValues[paramKey] = exportedValue;
|
|
8615
|
-
importParamNames.push(paramKey);
|
|
8616
|
-
importAssignments.push(`const ${named} = ${paramKey};`);
|
|
8617
|
-
} catch (err) {
|
|
8618
|
-
const paramKey = `__import_${Math.random().toString(36).substring(2, 11)}`;
|
|
8619
|
-
importedValues[paramKey] = null;
|
|
8620
|
-
importParamNames.push(paramKey);
|
|
8621
|
-
importAssignments.push(`const ${named} = ${paramKey}; /* Error importing ${resolvedPath}: ${err} */`);
|
|
8622
|
-
}
|
|
8623
|
-
} else {
|
|
8624
|
-
const requiredModule = __require(resolvedPath);
|
|
8625
|
-
const exportedValue = requiredModule[named];
|
|
8626
|
-
const paramKey = `__import_${Math.random().toString(36).substring(2, 11)}`;
|
|
8627
|
-
importedValues[paramKey] = exportedValue;
|
|
8628
|
-
importParamNames.push(paramKey);
|
|
8629
|
-
importAssignments.push(`const ${named} = ${paramKey};`);
|
|
8630
|
-
}
|
|
8631
|
-
}
|
|
8632
|
-
}
|
|
8633
|
-
let preamble = "";
|
|
8634
|
-
if (Object.keys(imports).length > 0) {
|
|
8635
|
-
const iifeStartMatch = code.match(/^(\s*(?:var\s+\w+\s*=\s*)?\(\(\)\s*=>\s*\{\n)/);
|
|
8636
|
-
if (iifeStartMatch) {
|
|
8637
|
-
const iifePrefix = iifeStartMatch[1];
|
|
8638
|
-
const assignments = `${importAssignments.join("\n")}
|
|
8639
|
-
`;
|
|
8640
|
-
preamble = iifePrefix;
|
|
8641
|
-
code = iifePrefix + assignments + code.slice(iifeStartMatch[1].length);
|
|
8642
|
-
} else {
|
|
8643
|
-
preamble = importAssignments.join("\n") + "\n";
|
|
8644
|
-
code = preamble + code;
|
|
8645
|
-
}
|
|
8646
|
-
}
|
|
8647
|
-
wrapperLineOffset = preamble.split("\n").length;
|
|
8653
|
+
wrapperLineOffset = 0;
|
|
8648
8654
|
setupGlobals();
|
|
8649
|
-
const
|
|
8650
|
-
const
|
|
8651
|
-
const
|
|
8652
|
-
|
|
8655
|
+
const moduleCache = /* @__PURE__ */ new Map();
|
|
8656
|
+
const moduleRecord = { exports: {} };
|
|
8657
|
+
const moduleObj = { exports: moduleRecord.exports };
|
|
8658
|
+
moduleCache.set(file, moduleRecord);
|
|
8659
|
+
const fn = new Function("module", "exports", "require", "__filename", "__dirname", code);
|
|
8660
|
+
const requireFn = createTestModuleRequire(file, moduleCache);
|
|
8661
|
+
await fn(moduleObj, moduleObj.exports, requireFn, file, testFileDir);
|
|
8653
8662
|
await executeSuite(currentSuite, timeout, bail);
|
|
8654
8663
|
if (currentSourceMapConsumer) {
|
|
8655
8664
|
currentSourceMapConsumer.destroy();
|
|
@@ -8714,22 +8723,22 @@ ${fileEntries.join("")}
|
|
|
8714
8723
|
for (const hook of beforeAllHooks) {
|
|
8715
8724
|
await hook();
|
|
8716
8725
|
}
|
|
8717
|
-
for (const
|
|
8718
|
-
if (hasOnly && !
|
|
8726
|
+
for (const test of suite.tests) {
|
|
8727
|
+
if (hasOnly && !test.only && !suite.only) {
|
|
8719
8728
|
continue;
|
|
8720
8729
|
}
|
|
8721
8730
|
let testMatches = true;
|
|
8722
8731
|
if (testPattern) {
|
|
8723
8732
|
const escapedPattern = escapeRegex(testPattern);
|
|
8724
8733
|
const regex = new RegExp(escapedPattern, "i");
|
|
8725
|
-
testMatches = regex.test(
|
|
8734
|
+
testMatches = regex.test(test.name);
|
|
8726
8735
|
}
|
|
8727
8736
|
if (!testMatches) {
|
|
8728
8737
|
continue;
|
|
8729
8738
|
}
|
|
8730
|
-
if (
|
|
8739
|
+
if (test.skip || suite.skip) {
|
|
8731
8740
|
testResults.push({
|
|
8732
|
-
name:
|
|
8741
|
+
name: test.name,
|
|
8733
8742
|
status: "skip",
|
|
8734
8743
|
duration: 0,
|
|
8735
8744
|
suite: suite.name,
|
|
@@ -8737,9 +8746,9 @@ ${fileEntries.join("")}
|
|
|
8737
8746
|
});
|
|
8738
8747
|
continue;
|
|
8739
8748
|
}
|
|
8740
|
-
if (
|
|
8749
|
+
if (test.todo) {
|
|
8741
8750
|
testResults.push({
|
|
8742
|
-
name:
|
|
8751
|
+
name: test.name,
|
|
8743
8752
|
status: "todo",
|
|
8744
8753
|
duration: 0,
|
|
8745
8754
|
suite: suite.name,
|
|
@@ -8753,13 +8762,13 @@ ${fileEntries.join("")}
|
|
|
8753
8762
|
const startTime = Date.now();
|
|
8754
8763
|
try {
|
|
8755
8764
|
await Promise.race([
|
|
8756
|
-
|
|
8765
|
+
test.fn(),
|
|
8757
8766
|
new Promise(
|
|
8758
|
-
(_, reject) => setTimeout(() => reject(new Error(`Test timed out after ${
|
|
8767
|
+
(_, reject) => setTimeout(() => reject(new Error(`Test timed out after ${test.timeout}ms`)), test.timeout)
|
|
8759
8768
|
)
|
|
8760
8769
|
]);
|
|
8761
8770
|
testResults.push({
|
|
8762
|
-
name:
|
|
8771
|
+
name: test.name,
|
|
8763
8772
|
status: "pass",
|
|
8764
8773
|
duration: Date.now() - startTime,
|
|
8765
8774
|
suite: suite.name,
|
|
@@ -8773,7 +8782,7 @@ ${fileEntries.join("")}
|
|
|
8773
8782
|
codeSnippet = error.codeSnippet;
|
|
8774
8783
|
}
|
|
8775
8784
|
testResults.push({
|
|
8776
|
-
name:
|
|
8785
|
+
name: test.name,
|
|
8777
8786
|
status: "fail",
|
|
8778
8787
|
duration: Date.now() - startTime,
|
|
8779
8788
|
error,
|