MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / _finishTest

Method _finishTest

lib/helper/Playwright.js:853–873  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

851 }
852
853 async _finishTest() {
854 if (this.isRunning) {
855 try {
856 await Promise.race([this._stopBrowser(), new Promise((_, reject) => setTimeout(() => reject(new Error('Test finish timeout')), 10000))])
857 } catch (e) {
858 console.warn('Warning during test finish cleanup:', e.message)
859 // Track cleanup failures to prevent false positives
860 this.hasCleanupError = true
861 this.testFailures.push(`Test finish cleanup failed: ${e.message}`)
862
863 this.isRunning = false
864 // Set flags to prevent further operations after cleanup failure
865 this.page = null
866 this.browserContext = null
867 this.browser = null
868
869 // Propagate the error to fail the test properly
870 throw new Error(`Test cleanup failed: ${e.message}`)
871 }
872 }
873 }
874
875 async _cleanup() {
876 // Final cleanup when test run completes

Callers

nothing calls this directly

Calls 2

_stopBrowserMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected