File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 266266 "jest-image-snapshot" : " ^6.5.1" ,
267267 "jest-puppeteer" : " ^11.0.0" ,
268268 "jquery" : " ^4.0.0" ,
269- "jsdom" : " ~28.0 .0" ,
269+ "jsdom" : " ~28.1 .0" ,
270270 "jsonml-to-react-element" : " ^1.1.11" ,
271271 "jsonml.js" : " ^0.1.0" ,
272272 "lint-staged" : " ^16.2.7" ,
Original file line number Diff line number Diff line change 11import '@testing-library/jest-dom' ;
22
33import { toHaveNoViolations } from 'jest-axe' ;
4- import jsdom from 'jsdom' ;
54import format , { plugins } from 'pretty-format' ;
65
76import { defaultConfig } from '../components/theme/internal' ;
@@ -90,12 +89,12 @@ expect.addSnapshotSerializer({
9089 test : ( node ) => node && typeof node === 'object' && node . type === 'demo' && node . html ,
9190 // @ts -ignore
9291 print : ( { html } ) => {
93- const { JSDOM } = jsdom ;
94- const { document } = new JSDOM ( ) . window ;
95- document . body . innerHTML = html ;
92+ // Create a temporary container to parse HTML
93+ const container = document . createElement ( 'div' ) ;
94+ container . innerHTML = html ;
9695
97- const children = Array . from ( document . body . childNodes ) . filter (
98- ( node ) =>
96+ const children = Array . from ( container . childNodes ) . filter (
97+ ( node : any ) =>
9998 // Ignore `link` node since React 18 or blew not support this
10099 node . nodeName !== 'LINK' ,
101100 ) ;
You can’t perform that action at this time.
0 commit comments