Skip to content

Commit 71af88a

Browse files
committed
refactor: balance onAfterRunSuite with onBeforeRunSuite
1 parent 4240535 commit 71af88a

File tree

1 file changed

+7
-8
lines changed
  • packages/vitest/src/runtime/runners

1 file changed

+7
-8
lines changed

packages/vitest/src/runtime/runners/test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ export class VitestTestRunner implements VitestRunner {
2727
this.snapshotClient.clear()
2828
}
2929

30-
async onAfterRunFiles() {
31-
// TOOD: should do `finishCurrentRun` in onAfterRunSuite with suite.filepath?
32-
const result = await this.snapshotClient.finishCurrentRun()
33-
if (result)
34-
await rpc().snapshotSaved(result)
35-
}
36-
37-
onAfterRunSuite(suite: Suite) {
30+
async onAfterRunSuite(suite: Suite) {
3831
if (this.config.logHeapUsage && typeof process !== 'undefined')
3932
suite.result!.heap = process.memoryUsage().heapUsed
33+
34+
if (suite.mode !== 'skip' && typeof suite.filepath !== 'undefined') {
35+
const result = await this.snapshotClient.finishCurrentRun()
36+
if (result)
37+
await rpc().snapshotSaved(result)
38+
}
4039
}
4140

4241
onAfterRunTask(test: Test) {

0 commit comments

Comments
 (0)