Skip to content

Commit

Permalink
fix(expect-puppeteer): fix expectMatch when body is undefined (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzane authored and gregberge committed Mar 8, 2018
1 parent b1ea334 commit 0c60970
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/expect-puppeteer/src/matchers/notToMatch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
async function notToMatch(page, matcher, options = { timeout: 500 }) {
try {
await page.waitForFunction(
`document.body.textContent.match(new RegExp('${matcher}')) === null`,
`document.body && document.body.textContent.match(new RegExp('${matcher}')) === null`,
options,
)
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/expect-puppeteer/src/matchers/toMatch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
async function toMatch(page, matcher, options = { timeout: 500 }) {
try {
await page.waitForFunction(
`document.body.textContent.match(new RegExp('${matcher}')) !== null`,
`document.body && document.body.textContent.match(new RegExp('${matcher}')) !== null`,
options,
)
} catch (error) {
Expand Down

0 comments on commit 0c60970

Please sign in to comment.