Skip to content

Instantly share code, notes, and snippets.

@ryanucode
Created January 25, 2017 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanucode/dabced71c64505f6ad1d4a1c63dbbbac to your computer and use it in GitHub Desktop.
Save ryanucode/dabced71c64505f6ad1d4a1c63dbbbac to your computer and use it in GitHub Desktop.
diff --git a/lib/html-assertions.js b/lib/html-assertions.js
index 5626921..c8ef359 100644
--- a/lib/html-assertions.js
+++ b/lib/html-assertions.js
@@ -5,6 +5,12 @@ const dom = require('jsdom').jsdom(rawHtml)
const document = dom
const window = dom.defaultView
+const rejections = new Set()
+process.on('unhandledRejection', (err, p) => rejections.add(p))
+process.on('rejectionHandled', (err, p) => rejections.delete(p))
+process.on('exit', () => {
+ rejections.forEach(p => p.catch(console.log))
+})
const existsFailMessage = selector => `Missing ${selector} element`
const notExistsFailMessage = selector => `${selector} element should not exist`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment