feat(worker): implement pageerror event from a worker (#2795)

Fixes #2761
This commit is contained in:
Yaniv Efraim
2018-06-26 01:10:36 +03:00
committed by Andrey Lushnikov
parent 811415bc8c
commit aae73f5fd7
3 changed files with 10 additions and 2 deletions

View File

@@ -48,5 +48,11 @@ module.exports.addTests = function({testRunner, expect}) {
const worker = await workerCreatedPromise;
expect(await (await worker.executionContext()).evaluate('1+1')).toBe(2);
});
it('should report errors', async function({page}) {
const errorPromise = new Promise(x => page.on('pageerror', x));
await page.evaluate(() => new Worker(`data:text/javascript, throw new Error('this is my error');`));
const errorLog = await errorPromise;
expect(errorLog.message).toContain('this is my error');
});
});
};