reactjstypescriptpuppeteerjest-puppeteer

The puppeteer closes the page after an error


While testing my page, an error is thrown from the dependency. The error is not critical and does not interfere with my application. But when testing with a puppeteer, with this error, he simply closes the tested page. How can I prevent this to continue testing further ignoring this error?

Example:
This error is thrown on the page and the test ends with it.

Error: TypeError: Cannot set property 'paddingLeft' of undefined
    at FrozenColumns.layoutRow (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:16595:26)
    at Row.initialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:5313:37)
    at Row.reinitialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:5376:8)
    at eval (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:4415:7)
    at Array.forEach (<anonymous>)
    at RowManager.reinitialize (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:4414:12)
    at ColumnManager.redraw (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:1206:25)
    at RowManager.refreshActiveData (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:3668:31)
    at RowManager.sorterRefresh (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:3482:8)
    at HTMLDivElement.eval (webpack-internal:///./node_modules/react-tabulator/node_modules/tabulator-tables/dist/js/tabulator.es2015.js:22644:27)

My environment:

Puppeteer version: 5.4.2
Platform / OS version: macOS 10.15.7
Node.js version: v12.16.1


Solution

  • When using jest-puppeteer, you can specify the exitOnPageError: false parameter in jest-puppeteer.config.js. In this case, the test will not complete if there is an error on the page.