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

Method onBeforeTryTask

packages/vitest/src/runtime/runners/test.ts:170–185  ·  view source on GitHub ↗
(test: Task)

Source from the content-addressed store, hash-verified

168 }
169
170 onBeforeTryTask(test: Task): void {
171 clearModuleMocks(this.config)
172 this.snapshotClient.clearTest(test.file.filepath, test.id)
173 setState(
174 {
175 assertionCalls: 0,
176 isExpectingAssertions: false,
177 isExpectingAssertionsError: null,
178 expectedAssertionsNumber: null,
179 expectedAssertionsNumberErrorGen: null,
180 currentTestName: getTestName(test),
181 snapshotState: this.snapshotClient.getSnapshotState(test.file.filepath),
182 },
183 (globalThis as any)[GLOBAL_EXPECT],
184 )
185 }
186
187 onAfterTryTask(test: Test): void {
188 const {

Callers 2

BrowserTestRunnerClass · 0.80
runTestFunction · 0.80

Calls 5

setStateFunction · 0.90
getTestNameFunction · 0.90
clearModuleMocksFunction · 0.85
getSnapshotStateMethod · 0.80
clearTestMethod · 0.45

Tested by

no test coverage detected