Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = async function globalTeardown (globalConfig) {
const teardown = []
// custom teardown
const ipfsd = global.__IPFSD__
if (ipfsd) teardown.push(ipfsd.stop())
// continue with global teardown
teardown.push(teardownDevServer())
teardown.push(teardownPuppeteer(globalConfig))
await Promise.all(teardown)
}
export async function destroyServer(globalConfig: Config.GlobalConfig) {
serverSetupPromise = undefined;
await teardown();
await teardownPuppeteer(globalConfig);
}
export async function teardown(jestConfig = {}) {
const config = await readConfig()
if (config.connect) {
await browser.disconnect()
} else {
await browser.close()
}
if (!jestConfig.watch && !jestConfig.watchAll) {
await teardownServer()
}
}