From 498492d4a3c63924e3325cf2d9f9d27d920c73a4 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 15 Aug 2019 12:03:48 -0700 Subject: [PATCH] test: add a test for errors inside promise (#4838) The bug was fixed upstream in V8 and rolled into chromium at r686227. This adds a test. Fix #4651 --- test/evaluation.spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js index 26f19b56..3f68c8be 100644 --- a/test/evaluation.spec.js +++ b/test/evaluation.spec.js @@ -255,6 +255,13 @@ module.exports.addTests = function({testRunner, expect}) { const a = await page.evaluate(() => Array(100 * 1024 * 1024 + 1).join('a')); expect(a.length).toBe(100 * 1024 * 1024); }); + it('should throw error with detailed information on exception inside promise ', async({page, server}) => { + let error = null; + await page.evaluate(() => new Promise(() => { + throw new Error('Error in promise'); + })).catch(e => error = e); + expect(error.message).toContain('Error in promise'); + }); }); describe('Page.evaluateOnNewDocument', function() {