@vitest/runner 3.2.1 → 3.2.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/chunk-hooks.js +17 -9
- package/dist/index.js +1 -0
- package/dist/utils.js +1 -0
- package/package.json +3 -2
package/dist/chunk-hooks.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { isObject, createDefer, toArray, isNegativeNaN, format, objectAttr, objDisplay,
|
1
|
+
import { isObject, createDefer, toArray, isNegativeNaN, format, objectAttr, objDisplay, getSafeTimers, shuffle, assertTypes } from '@vitest/utils';
|
2
2
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
3
3
|
import { processError } from '@vitest/utils/error';
|
4
|
+
import { stripLiteral } from 'strip-literal';
|
4
5
|
import { relative } from 'pathe';
|
5
6
|
|
6
7
|
class PendingError extends Error {
|
@@ -283,9 +284,9 @@ function resolveDeps(fixtures, depSet = new Set(), pendingFixtures = []) {
|
|
283
284
|
return pendingFixtures;
|
284
285
|
}
|
285
286
|
function getUsedProps(fn) {
|
286
|
-
let fnString = fn.toString();
|
287
|
+
let fnString = stripLiteral(fn.toString());
|
287
288
|
// match lowered async function and strip it off
|
288
|
-
// example code on esbuild-try https://esbuild.github.io/try/#YgAwLjI0LjAALS1zdXBwb3J0ZWQ6YXN5bmMtYXdhaXQ9ZmFsc2UAZQBlbnRyeS50cwBjb25zdCBvID0gewogIGYxOiBhc3luYyAoKSA9PiB7fSwKICBmMjogYXN5bmMgKGEpID0+IHt9LAogIGYzOiBhc3luYyAoYSwgYikgPT4ge30sCiAgZjQ6IGFzeW5jIGZ1bmN0aW9uKGEpIHt9LAogIGY1OiBhc3luYyBmdW5jdGlvbiBmZihhKSB7fSwKICBhc3luYyBmNihhKSB7fSwKCiAgZzE6IGFzeW5jICgpID0+IHt9LAogIGcyOiBhc3luYyAoeyBhIH0pID0+IHt9LAogIGczOiBhc3luYyAoeyBhIH0sIGIpID0+
|
289
|
+
// example code on esbuild-try https://esbuild.github.io/try/#YgAwLjI0LjAALS1zdXBwb3J0ZWQ6YXN5bmMtYXdhaXQ9ZmFsc2UAZQBlbnRyeS50cwBjb25zdCBvID0gewogIGYxOiBhc3luYyAoKSA9PiB7fSwKICBmMjogYXN5bmMgKGEpID0+IHt9LAogIGYzOiBhc3luYyAoYSwgYikgPT4ge30sCiAgZjQ6IGFzeW5jIGZ1bmN0aW9uKGEpIHt9LAogIGY1OiBhc3luYyBmdW5jdGlvbiBmZihhKSB7fSwKICBhc3luYyBmNihhKSB7fSwKCiAgZzE6IGFzeW5jICgpID0+IHt9LAogIGcyOiBhc3luYyAoeyBhIH0pID0+IHt9LAogIGczOiBhc3luYyAoeyBhIH0sIGIpID0+IHt9LAogIGc0OiBhc3luYyBmdW5jdGlvbiAoeyBhIH0pIHt9LAogIGc1OiBhc3luYyBmdW5jdGlvbiBnZyh7IGEgfSkge30sCiAgYXN5bmMgZzYoeyBhIH0pIHt9LAoKICBoMTogYXN5bmMgKCkgPT4ge30sCiAgLy8gY29tbWVudCBiZXR3ZWVuCiAgaDI6IGFzeW5jIChhKSA9PiB7fSwKfQ
|
289
290
|
// __async(this, null, function*
|
290
291
|
// __async(this, arguments, function*
|
291
292
|
// __async(this, [_0, _1], function*
|
@@ -641,7 +642,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
641
642
|
}
|
642
643
|
if (runner.config.includeTaskLocation) {
|
643
644
|
const error = stackTraceError.stack;
|
644
|
-
const stack = findTestFileStackTrace(error
|
645
|
+
const stack = findTestFileStackTrace(error);
|
645
646
|
if (stack) {
|
646
647
|
task.location = stack;
|
647
648
|
}
|
@@ -714,7 +715,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
|
|
714
715
|
Error.stackTraceLimit = 15;
|
715
716
|
const error = new Error("stacktrace").stack;
|
716
717
|
Error.stackTraceLimit = limit;
|
717
|
-
const stack = findTestFileStackTrace(error
|
718
|
+
const stack = findTestFileStackTrace(error);
|
718
719
|
if (stack) {
|
719
720
|
suite.location = stack;
|
720
721
|
}
|
@@ -969,15 +970,16 @@ function formatTemplateString(cases, args) {
|
|
969
970
|
}
|
970
971
|
return res;
|
971
972
|
}
|
972
|
-
function findTestFileStackTrace(error
|
973
|
+
function findTestFileStackTrace(error) {
|
974
|
+
const testFilePath = getTestFilepath();
|
973
975
|
// first line is the error message
|
974
976
|
const lines = error.split("\n").slice(1);
|
975
977
|
for (const line of lines) {
|
976
978
|
const stack = parseSingleStack(line);
|
977
|
-
if (stack && stack.file ===
|
979
|
+
if (stack && stack.file === testFilePath) {
|
978
980
|
return {
|
979
981
|
line: stack.line,
|
980
|
-
column:
|
982
|
+
column: stack.column
|
981
983
|
};
|
982
984
|
}
|
983
985
|
}
|
@@ -1356,6 +1358,7 @@ function getTestName(task, separator = " > ") {
|
|
1356
1358
|
|
1357
1359
|
const now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
1358
1360
|
const unixNow = Date.now;
|
1361
|
+
const { clearTimeout, setTimeout } = getSafeTimers();
|
1359
1362
|
function updateSuiteHookState(task, name, state, runner) {
|
1360
1363
|
if (!task.result) {
|
1361
1364
|
task.result = { state: "run" };
|
@@ -1474,12 +1477,17 @@ async function finishSendTasksUpdate(runner) {
|
|
1474
1477
|
}
|
1475
1478
|
function throttle(fn, ms) {
|
1476
1479
|
let last = 0;
|
1477
|
-
|
1480
|
+
let pendingCall;
|
1481
|
+
return function call(...args) {
|
1478
1482
|
const now = unixNow();
|
1479
1483
|
if (now - last > ms) {
|
1480
1484
|
last = now;
|
1485
|
+
clearTimeout(pendingCall);
|
1486
|
+
pendingCall = undefined;
|
1481
1487
|
return fn.apply(this, args);
|
1482
1488
|
}
|
1489
|
+
// Make sure fn is still called even if there are no further calls
|
1490
|
+
pendingCall ?? (pendingCall = setTimeout(() => call.bind(this)(...args), ms));
|
1483
1491
|
};
|
1484
1492
|
}
|
1485
1493
|
// throttle based on summary reporter's DURATION_UPDATE_INTERVAL_MS
|
package/dist/index.js
CHANGED
package/dist/utils.js
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/runner",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.2.
|
4
|
+
"version": "3.2.3",
|
5
5
|
"description": "Vitest test runner",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -39,7 +39,8 @@
|
|
39
39
|
],
|
40
40
|
"dependencies": {
|
41
41
|
"pathe": "^2.0.3",
|
42
|
-
"
|
42
|
+
"strip-literal": "^3.0.0",
|
43
|
+
"@vitest/utils": "3.2.3"
|
43
44
|
},
|
44
45
|
"scripts": {
|
45
46
|
"build": "rimraf dist && rollup -c",
|