@internal
()
| 231 | |
| 232 | /** @internal */ |
| 233 | async _initializeGlobalSetup() { |
| 234 | if (this._globalSetups) { |
| 235 | return |
| 236 | } |
| 237 | |
| 238 | this._globalSetups = await loadGlobalSetupFiles( |
| 239 | this.runner, |
| 240 | this.config.globalSetup, |
| 241 | ) |
| 242 | |
| 243 | for (const globalSetupFile of this._globalSetups) { |
| 244 | const teardown = await globalSetupFile.setup?.(this) |
| 245 | if (teardown == null || !!globalSetupFile.teardown) { |
| 246 | continue |
| 247 | } |
| 248 | if (typeof teardown !== 'function') { |
| 249 | throw new TypeError( |
| 250 | `invalid return value in globalSetup file ${globalSetupFile.file}. Must return a function`, |
| 251 | ) |
| 252 | } |
| 253 | globalSetupFile.teardown = teardown |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | onTestsRerun(cb: OnTestsRerunHandler): void { |
| 258 | this.vitest.onTestsRerun(cb) |
no test coverage detected