From 50630bb7a21d5e1b656bf2cfe6114445b120f348 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Mon, 16 Mar 2020 20:45:56 +0800 Subject: [PATCH] figure out why test failed --- test/custom-elements/index.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/test/custom-elements/index.js b/test/custom-elements/index.js index bbee66b4fd71..cf9cb3c73daa 100644 --- a/test/custom-elements/index.js +++ b/test/custom-elements/index.js @@ -42,15 +42,29 @@ describe('custom-elements', function() { }); } - before(async () => { - svelte = loadSvelte(); - server = await create_server(); - browser = await puppeteer.launch(); + before(async (done) => { + try { + svelte = loadSvelte(); + server = await create_server(); + browser = await puppeteer.launch(); + console.log('Success!'); + done(); + } catch (error) { + console.log('Error', error); + done(); + } }); - after(async () => { - server.close(); - await browser.close(); + after(async (done) => { + try { + server.close(); + await browser.close(); + console.log('Success!'); + done(); + } catch (error) { + console.log('Error', error); + done(); + } }); fs.readdirSync(`${__dirname}/samples`).forEach(dir => {