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

Function teardown

test/workspaces/globalTest.ts:33–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31let teardownCalled = false
32
33export async function teardown() {
34 teardownCalled = true
35 const results = JSON.parse(await readFile('./results.json', 'utf-8'))
36
37 try {
38 assert.ok(results.success)
39 assert.equal(results.numTotalTestSuites, 20)
40 assert.equal(results.numTotalTests, 25)
41 assert.equal(results.numPassedTests, 25)
42 assert.ok(results.coverageMap)
43
44 const shared = results.testResults.filter((r: any) => r.name.includes('space_shared/test.spec.ts'))
45
46 assert.equal(shared.length, 2)
47 }
48 catch (err) {
49 console.error(err)
50 // eslint-disable-next-line no-console
51 console.dir(results, { depth: null })
52 process.exit(1)
53 }
54}
55
56process.on('beforeExit', () => {
57 if (!teardownCalled) {

Callers

nothing calls this directly

Calls 5

readFileFunction · 0.85
okMethod · 0.80
errorMethod · 0.80
exitMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected