From a0003354d83b96b308d97f54159fe0e86262c027 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 20 Apr 2020 13:00:31 -0700 Subject: [PATCH] test: add a test for sourceURL in exception stacks (#1880) --- test/page.spec.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/page.spec.js b/test/page.spec.js index 4b644d9c5e..faddfaf769 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -500,12 +500,18 @@ describe('Page.Events.PageError', function() { expect(error.name).toBe('Error'); expect(error.message).toBe('Fancy error!'); let stack = await page.evaluate(() => window.e.stack); - // Note that WebKit does not use sourceURL for some reason and reports the stack of the 'throw' statement - // instead of the Error constructor call. + // Note that WebKit reports the stack of the 'throw' statement instead of the Error constructor call. if (WEBKIT) stack = stack.replace('14:25', '15:19'); expect(error.stack).toBe(stack); }); + it.fail(WEBKIT)('should contain sourceURL', async({page, server}) => { + const [error] = await Promise.all([ + page.waitForEvent('pageerror'), + page.goto(server.PREFIX + '/error.html'), + ]); + expect(error.stack).toContain('myscript.js'); + }); }); describe('Page.setContent', function() {