@vitest/runner
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -1,2 +0,2 @@ | ||
import { getSafeTimers, isObject, createDefer, isNegativeNaN, format, objDisplay, objectAttr, toArray, shuffle } from '@vitest/utils'; | ||
import { getSafeTimers, isObject, createDefer, isNegativeNaN, format, objDisplay, objectAttr, toArray, shuffle, assertTypes } from '@vitest/utils'; | ||
import { processError } from '@vitest/utils/error'; | ||
@@ -227,3 +227,7 @@ export { processError } from '@vitest/utils/error'; | ||
function getUsedProps(fn) { | ||
const match = fn.toString().match(/[^(]*\(([^)]*)/); | ||
let fnString = fn.toString(); | ||
if (/__async\(this, (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) { | ||
fnString = fnString.split("__async(this,")[1]; | ||
} | ||
const match = fnString.match(/[^(]*\(([^)]*)/); | ||
if (!match) { | ||
@@ -1021,2 +1025,20 @@ return []; | ||
} | ||
try { | ||
await callTaskHooks(test, test.onFinished || [], "stack"); | ||
} catch (e) { | ||
failTask(test.result, e, runner.config.diffOptions); | ||
} | ||
if (test.result.state === "fail") { | ||
try { | ||
await callTaskHooks( | ||
test, | ||
test.onFailed || [], | ||
runner.config.sequence.hooks | ||
); | ||
} catch (e) { | ||
failTask(test.result, e, runner.config.diffOptions); | ||
} | ||
} | ||
delete test.onFailed; | ||
delete test.onFinished; | ||
if (test.result.state === "pass") { | ||
@@ -1032,18 +1054,2 @@ break; | ||
} | ||
try { | ||
await callTaskHooks(test, test.onFinished || [], "stack"); | ||
} catch (e) { | ||
failTask(test.result, e, runner.config.diffOptions); | ||
} | ||
if (test.result.state === "fail") { | ||
try { | ||
await callTaskHooks( | ||
test, | ||
test.onFailed || [], | ||
runner.config.sequence.hooks | ||
); | ||
} catch (e) { | ||
failTask(test.result, e, runner.config.diffOptions); | ||
} | ||
} | ||
if (test.fails) { | ||
@@ -1108,9 +1114,14 @@ if (test.result.state === "pass") { | ||
try { | ||
beforeAllCleanups = await callSuiteHook( | ||
suite, | ||
suite, | ||
"beforeAll", | ||
runner, | ||
[suite] | ||
); | ||
try { | ||
beforeAllCleanups = await callSuiteHook( | ||
suite, | ||
suite, | ||
"beforeAll", | ||
runner, | ||
[suite] | ||
); | ||
} catch (e) { | ||
markTasksAsSkipped(suite, runner); | ||
throw e; | ||
} | ||
if (runner.runSuite) { | ||
@@ -1218,2 +1229,3 @@ await runner.runSuite(suite); | ||
function beforeAll(fn, timeout) { | ||
assertTypes(fn, '"beforeAll" callback', ["function"]); | ||
return getCurrentSuite().on( | ||
@@ -1225,2 +1237,3 @@ "beforeAll", | ||
function afterAll(fn, timeout) { | ||
assertTypes(fn, '"afterAll" callback', ["function"]); | ||
return getCurrentSuite().on( | ||
@@ -1232,2 +1245,3 @@ "afterAll", | ||
function beforeEach(fn, timeout) { | ||
assertTypes(fn, '"beforeEach" callback', ["function"]); | ||
return getCurrentSuite().on( | ||
@@ -1239,2 +1253,3 @@ "beforeEach", | ||
function afterEach(fn, timeout) { | ||
assertTypes(fn, '"afterEach" callback', ["function"]); | ||
return getCurrentSuite().on( | ||
@@ -1265,2 +1280,3 @@ "afterEach", | ||
return (fn, timeout) => { | ||
assertTypes(fn, `"${name}" callback`, ["function"]); | ||
const current = getCurrentTest(); | ||
@@ -1267,0 +1283,0 @@ if (!current) { |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Vitest test runner", | ||
@@ -42,3 +42,3 @@ "license": "MIT", | ||
"pathe": "^1.1.2", | ||
"@vitest/utils": "2.1.1" | ||
"@vitest/utils": "2.1.2" | ||
}, | ||
@@ -45,0 +45,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
88581
2399
6
+ Added@vitest/pretty-format@2.1.2(transitive)
+ Added@vitest/utils@2.1.2(transitive)
- Removed@vitest/pretty-format@2.1.1(transitive)
- Removed@vitest/utils@2.1.1(transitive)
Updated@vitest/utils@2.1.2