test: puppeteer auto close

This commit is contained in:
DIYgod
2019-06-13 18:37:55 +08:00
parent 510c849da7
commit 749ede3af8
2 changed files with 8 additions and 5 deletions

View File

@@ -18,10 +18,10 @@ module.exports = async () => {
browser = await puppeteer.launch(options);
}
setTimeout(async () => {
if ((await browser.process()).signalCode) {
if ((await browser.process()).exitCode === null) {
browser.close();
}
}, 5000);
}, 10000);
return browser;
};