diff --git a/TD45/all.test.js b/TD45/all.test.js index c5737f9f38f3bae2068042bf575565801c7793ef..13cef0b17e50618aba83197a93f4b2fd9ee2c660 100644 --- a/TD45/all.test.js +++ b/TD45/all.test.js @@ -69,7 +69,11 @@ if (progression >= 27) { const browser = await puppeteer.launch(); const page = await browser.newPage(); const consoleLogs = []; - page.on('console', async consoleObj => { consoleLogs.push(await consoleObj.args()[0]?.jsonValue()) }); + page.on('console', async consoleObj => { + const line = await consoleObj.args()[0]?.jsonValue(); + if (line == undefined) return; + consoleLogs.push(line) + }); await page.goto(`http://localhost:${fastify.server.address().port}`); const content = await page.content(); const dom = new JSDOM(content); @@ -96,6 +100,7 @@ if (progression >= 28 && progression < 30) { const args = consoleObj.args(); const arg0 = args[0]; const json = await arg0.jsonValue(); + if (json == undefined) return; consoleLogs.push(json) }); await page.goto(`http://localhost:${fastify.server.address().port}`); @@ -122,6 +127,7 @@ if (progression == 29) { const args = consoleObj.args(); const arg0 = args[0]; const json = await arg0.jsonValue(); + if (json == undefined) return; consoleLogs.push(json) }); await page.goto(`http://localhost:${fastify.server.address().port}`);