Created
January 25, 2017 22:32
-
-
Save ryanucode/dabced71c64505f6ad1d4a1c63dbbbac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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