expect-puppeteer
Advanced tools
Comparing version 8.0.5 to 9.0.0
'use strict'; | ||
var expect = require('@jest/expect'); | ||
const checkIsPuppeteerInstance = (instance)=>{ | ||
@@ -259,2 +257,8 @@ return Boolean(instance?.constructor?.name && typeof instance === "object" && "$" in instance); | ||
// import { | ||
// getContext, | ||
// enhanceError, | ||
// PuppeteerInstance, | ||
// Selector, | ||
// } from "../utils"; | ||
// import { defaultOptions, Options } from "../options"; | ||
async function notToMatchElement(instance, selector, options = {}) { | ||
@@ -450,5 +454,7 @@ const { text , visible , ...otherOptions } = options; | ||
}; | ||
// @ts-ignore | ||
const jestExpect = global.expect; | ||
const wrapMatcher = (matcher, instance)=>{ | ||
return async function throwingMatcher(...args) { | ||
expect.jestExpect.getState().assertionCalls += 1; | ||
jestExpect.getState().assertionCalls += 1; | ||
try { | ||
@@ -489,3 +495,3 @@ return await matcher(instance, ...args); | ||
const matchers = expectPuppeteerInstance(actual); | ||
const jestMatchers = expect.jestExpect(actual); | ||
const jestMatchers = jestExpect(actual); | ||
return { | ||
@@ -500,7 +506,7 @@ ...jestMatchers, | ||
} | ||
return expect.jestExpect(actual); | ||
return jestExpect(actual); | ||
}; | ||
Object.keys(expect.jestExpect).forEach((prop)=>{ | ||
Object.keys(jestExpect).forEach((prop)=>{ | ||
// @ts-ignore | ||
expectPuppeteer[prop] = expect.jestExpect[prop]; | ||
expectPuppeteer[prop] = jestExpect[prop]; | ||
}); | ||
@@ -507,0 +513,0 @@ const globalWithExpect = global; |
{ | ||
"name": "expect-puppeteer", | ||
"description": "Assertion toolkit for Puppeteer.", | ||
"version": "8.0.5", | ||
"version": "9.0.0", | ||
"type": "commonjs", | ||
@@ -26,3 +26,3 @@ "main": "./dist/index.js", | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=16" | ||
}, | ||
@@ -48,8 +48,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"puppeteer": "^19.7.3", | ||
"rollup": "^3.18.0", | ||
"rollup-plugin-dts": "^5.2.0", | ||
"rollup-plugin-swc3": "^0.8.0" | ||
"puppeteer": "^20.3.0", | ||
"rollup": "^3.23.0", | ||
"rollup-plugin-dts": "^5.3.0", | ||
"rollup-plugin-swc3": "^0.8.1" | ||
}, | ||
"gitHead": "05992b2c3082b68bac0fffb8e4f1847a7ae4472d" | ||
"gitHead": "e13d1ddce8f557405419b37cc2f6f37b4fe45212" | ||
} |
36471
612