@vitest/runner
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -114,7 +114,8 @@ import limit from 'p-limit'; | ||
const fixtureValueMaps = /* @__PURE__ */ new Map(); | ||
let cleanupFnArray = new Array(); | ||
async function callFixtureCleanup() { | ||
const cleanupFnArrayMap = /* @__PURE__ */ new Map(); | ||
async function callFixtureCleanup(context) { | ||
const cleanupFnArray = cleanupFnArrayMap.get(context) ?? []; | ||
for (const cleanup of cleanupFnArray.reverse()) | ||
await cleanup(); | ||
cleanupFnArray = []; | ||
cleanupFnArrayMap.delete(context); | ||
} | ||
@@ -135,2 +136,5 @@ function withFixtures(fn, testContext) { | ||
const fixtureValueMap = fixtureValueMaps.get(context); | ||
if (!cleanupFnArrayMap.has(context)) | ||
cleanupFnArrayMap.set(context, []); | ||
const cleanupFnArray = cleanupFnArrayMap.get(context); | ||
const usedFixtures = fixtures.filter(({ prop }) => usedProps.includes(prop)); | ||
@@ -155,3 +159,3 @@ const pendingFixtures = resolveDeps(usedFixtures); | ||
} | ||
async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray2) { | ||
async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) { | ||
const useFnArgPromise = createDefer(); | ||
@@ -163,3 +167,3 @@ let isUseFnArgResolved = false; | ||
const useReturnPromise = createDefer(); | ||
cleanupFnArray2.push(async () => { | ||
cleanupFnArray.push(async () => { | ||
useReturnPromise.resolve(); | ||
@@ -248,3 +252,3 @@ await fixtureReturn; | ||
if (getCurrentTest()) | ||
throw new Error("Nested tests are not allowed"); | ||
throw new Error('Calling the test function inside another test function is not allowed. Please put it inside "describe" or "suite" so it can be properly collected.'); | ||
getCurrentSuite().test.fn.call(this, formatName(name), fn, options); | ||
@@ -704,3 +708,3 @@ } | ||
await callCleanupHooks(beforeEachCleanups); | ||
await callFixtureCleanup(); | ||
await callFixtureCleanup(test.context); | ||
} catch (e) { | ||
@@ -707,0 +711,0 @@ failTask(test.result, e, runner.config.diffOptions); |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Vitest test runner", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
"pathe": "^1.1.1", | ||
"@vitest/utils": "1.1.1" | ||
"@vitest/utils": "1.1.2" | ||
}, | ||
@@ -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
57477
1448
+ Added@types/estree@1.0.6(transitive)
+ Added@vitest/utils@1.1.2(transitive)
+ Addedestree-walker@3.0.3(transitive)
- Removed@vitest/utils@1.1.1(transitive)
Updated@vitest/utils@1.1.2