[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix(runner): mark tests as skipped when `beforeAll` failed (#6524)

authored by

Hiroshi Ogawa and committed by
GitHub
(Sep 25, 2024, 10:32 AM +0200) fb79792d 7727ca87

+16 -8
+13 -7
packages/runner/src/run.ts
··· 382 382 } 383 383 else { 384 384 try { 385 - beforeAllCleanups = await callSuiteHook( 386 - suite, 387 - suite, 388 - 'beforeAll', 389 - runner, 390 - [suite], 391 - ) 385 + try { 386 + beforeAllCleanups = await callSuiteHook( 387 + suite, 388 + suite, 389 + 'beforeAll', 390 + runner, 391 + [suite], 392 + ) 393 + } 394 + catch (e) { 395 + markTasksAsSkipped(suite, runner) 396 + throw e 397 + } 392 398 393 399 if (runner.runSuite) { 394 400 await runner.runSuite(suite)
+3 -1
test/reporters/tests/__snapshots__/junit.test.ts.snap
··· 25 25 exports[`emits <failure> when beforeAll/afterAll failed 1`] = ` 26 26 "<?xml version="1.0" encoding="UTF-8" ?> 27 27 <testsuites name="vitest tests" tests="8" failures="2" errors="0" time="..."> 28 - <testsuite name="basic.test.ts" timestamp="..." hostname="..." tests="8" failures="2" errors="0" skipped="2" time="..."> 28 + <testsuite name="basic.test.ts" timestamp="..." hostname="..." tests="8" failures="2" errors="0" skipped="4" time="..."> 29 29 <testcase classname="basic.test.ts" name="suite with beforeAll &gt; ok 1" time="..."> 30 + <skipped/> 30 31 </testcase> 31 32 <testcase classname="basic.test.ts" name="suite with beforeAll &gt; ok 2" time="..."> 33 + <skipped/> 32 34 </testcase> 33 35 <testcase classname="basic.test.ts" name="suite with beforeAll &gt; skip 1" time="..."> 34 36 <skipped/>