Skip to content

Commit

Permalink
Makes the script crash on unhandled rejections instead of silently ig…
Browse files Browse the repository at this point in the history
…noring them

See jestjs/jest#5311 (comment)

✗ Errored » Asynchronous Error
      in Integration tests
      in test/integration-test.js
/home/macbre/github/phantomas/test/integration-test.js:19
	throw err;
	^

Error: Protocol error (Performance.getMetrics): Session closed. Most likely the page has been closed.
    at CDPSession.send (/home/macbre/github/phantomas/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:195:35)
    at Page.metrics (/home/macbre/github/phantomas/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:699:45)
    at /home/macbre/github/phantomas/lib/browser.js:266:37
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
  • Loading branch information
macbre committed Oct 26, 2020
1 parent 0ebdfd7 commit 9c12bdc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/integration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ var vows = require('vows'),

var WEBROOT = 'http://127.0.0.1:8888'; // see start-server.sh

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// run the test
var suite = vows.describe('Integration tests').addBatch({
'test server': {
Expand Down

0 comments on commit 9c12bdc

Please sign in to comment.