File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
packages/expect-puppeteer/src Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` expect-puppeteer should works with \` addSnapshotSerializer\` 1` ] = ` hello` ;
Original file line number Diff line number Diff line change 11import { getDefaultOptions , setDefaultOptions } from "." ;
22
3+ expect . addSnapshotSerializer ( {
4+ print : ( ) => "hello" ,
5+ test : ( ) => true ,
6+ serialize : ( ) => "hello" ,
7+ } ) ;
8+
39describe ( "expect-puppeteer" , ( ) => {
410 beforeEach ( async ( ) => {
511 await page . goto ( `http://localhost:${ process . env . TEST_SERVER_PORT } ` ) ;
@@ -16,6 +22,10 @@ describe("expect-puppeteer", () => {
1622 expect ( 200 ) . toBe ( 200 ) ;
1723 } ) ;
1824
25+ it ( "should works with `addSnapshotSerializer`" , ( ) => {
26+ expect ( { hello : "world" } ) . toMatchSnapshot ( ) ;
27+ } ) ;
28+
1929 it ( "should get and set default options" , ( ) => {
2030 expect ( getDefaultOptions ( ) ) . toEqual ( { timeout : 500 } ) ;
2131 setDefaultOptions ( { timeout : 200 } ) ;
Original file line number Diff line number Diff line change 66 checkIsPage ,
77 PuppeteerInstance ,
88} from "./utils" ;
9- import { jestExpect , JestExpect } from "@jest/expect" ;
9+ import type { JestExpect } from "@jest/expect" ;
1010import { notToMatchTextContent } from "./matchers/notToMatchTextContent" ;
1111import { notToMatchElement } from "./matchers/notToMatchElement" ;
1212import { toClick } from "./matchers/toClick" ;
@@ -95,6 +95,9 @@ export type PuppeteerMatchers =
9595 | MatchersFromSet < PageMatchers >
9696 | MatchersFromSet < ElementHandleMatchers > ;
9797
98+ // @ts -ignore
99+ const jestExpect = global . expect as JestExpect ;
100+
98101const wrapMatcher = < TPage extends PuppeteerInstance > (
99102 matcher : Matcher < TPage > ,
100103 instance : PuppeteerInstance
You can’t perform that action at this time.
0 commit comments