Skip to content

Commit

Permalink
Throw in a human readable way if jsdom is not installed locally when …
Browse files Browse the repository at this point in the history
…running outside of a browser
  • Loading branch information
Munter committed Apr 23, 2015
1 parent 31c1016 commit a2d6666
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ module.exports = {
htmlDocument.write(subject);
htmlDocument.close();
} else {
htmlDocument = require('jsdom').jsdom(subject);
try {
htmlDocument = require('jsdom').jsdom(subject);
} catch (err) {
throw new Error('The assertion `when parsed as html` was run outside a browser, but could not find the `jsdom` module. Please npm install jsdom to make this work.');
}
}
return this.shift(expect, htmlDocument, 0);
});
Expand Down

0 comments on commit a2d6666

Please sign in to comment.