@vitest/runner
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -669,2 +669,12 @@ import limit from 'p-limit'; | ||
} | ||
async function callTaskHooks(task, hooks, sequence) { | ||
if (sequence === "stack") | ||
hooks = hooks.slice().reverse(); | ||
if (sequence === "parallel") { | ||
await Promise.all(hooks.map((fn) => fn(task.result))); | ||
} else { | ||
for (const fn of hooks) | ||
await fn(task.result); | ||
} | ||
} | ||
async function callSuiteHook(suite, currentTask, name, runner, args) { | ||
@@ -731,3 +741,3 @@ const sequence = runner.config.sequence.hooks; | ||
async function runTest(test, runner) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b, _c, _d, _e, _f; | ||
await ((_a = runner.onBeforeRunTask) == null ? void 0 : _a.call(runner, test)); | ||
@@ -805,3 +815,3 @@ if (test.mode !== "run") | ||
try { | ||
await Promise.all(((_f = test.onFinished) == null ? void 0 : _f.map((fn) => fn(test.result))) || []); | ||
await callTaskHooks(test, test.onFinished || [], "stack"); | ||
} catch (e) { | ||
@@ -812,3 +822,3 @@ failTask(test.result, e, runner.config.diffOptions); | ||
try { | ||
await Promise.all(((_g = test.onFailed) == null ? void 0 : _g.map((fn) => fn(test.result))) || []); | ||
await callTaskHooks(test, test.onFailed || [], runner.config.sequence.hooks); | ||
} catch (e) { | ||
@@ -830,3 +840,3 @@ failTask(test.result, e, runner.config.diffOptions); | ||
test.result.duration = now() - start; | ||
await ((_h = runner.onAfterRunTask) == null ? void 0 : _h.call(runner, test)); | ||
await ((_f = runner.onAfterRunTask) == null ? void 0 : _f.call(runner, test)); | ||
updateTask(test, runner); | ||
@@ -833,0 +843,0 @@ } |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Vitest test runner", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
"pathe": "^1.1.1", | ||
"@vitest/utils": "1.5.0" | ||
"@vitest/utils": "1.5.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63588
1605
+ Added@vitest/utils@1.5.1(transitive)
- Removed@vitest/utils@1.5.0(transitive)
Updated@vitest/utils@1.5.1