MCPcopy
hub / github.com/vitest-dev/vitest / teardown

Function teardown

test/workspaces-browser/globalTest.ts:6–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4let teardownCalled = false
5
6export async function teardown() {
7 teardownCalled = true
8 const results = JSON.parse(await readFile('./results.json', 'utf-8'))
9
10 try {
11 assert.ok(results.success)
12 assert.equal(results.numTotalTestSuites, 4)
13 assert.equal(results.numTotalTests, 5)
14 assert.equal(results.numPassedTests, 5)
15 }
16 catch (err) {
17 console.error(err)
18 // eslint-disable-next-line no-console
19 console.dir(results, { depth: null })
20 process.exit(1)
21 }
22}
23
24process.on('beforeExit', () => {
25 if (!teardownCalled) {

Callers

nothing calls this directly

Calls 4

readFileFunction · 0.85
okMethod · 0.80
errorMethod · 0.80
exitMethod · 0.80

Tested by

no test coverage detected