Skip to content

Commit b9d33cd

Browse files
committed
E2E: Properly clean up on SIGINT.
1 parent d7f67fa commit b9d33cd

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

test/e2e/puppeteer.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,24 @@ const app = express();
121121
app.use( express.static( path.resolve() ) );
122122
const server = app.listen( port, main );
123123

124-
process.on( 'SIGINT', () => close() );
124+
process.on( 'SIGINT', async () => {
125+
126+
console.log( '\nInterrupted, cleaning up...' );
127+
128+
if ( browser ) {
129+
130+
try {
131+
132+
await browser.close();
133+
134+
} catch {}
135+
136+
}
137+
138+
server.close();
139+
process.exit( 1 );
140+
141+
} );
125142

126143
async function main() {
127144

0 commit comments

Comments
 (0)