1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/script/kill-server-for-jest.js
Kevin Heis 2182ff28f3 Next12 now supports ESM (#29295)
* Next12 now supports ESM

* No more michael jackson script extensions

* Fix test running

* Update jest-puppeteer.config.cjs

* Update package.json
2022-07-26 17:53:23 +00:00

25 lines
691 B
JavaScript
Executable File

#!/usr/bin/env node
import teardownJestPuppeteer from 'jest-environment-puppeteer/teardown.js'
import { START_JEST_SERVER, isServerHealthy, killServer } from './server-for-jest.js'
export default async () => {
if (START_JEST_SERVER) {
global.__SERVER__.close()
if (await isServerHealthy()) {
killServer()
}
}
// The way jest-puppeteer works is that you add a preset in
// `jest.config.js` but that preset will clash with the execution
// of this script. So we have to manually do what we do normally
// do in `jest.config.js`
// Note, we can delete this when we migrate to Playwright.
if (process.env.BROWSER) {
await teardownJestPuppeteer()
}
}