Skip to content

Commit

Permalink
Upgrade jest and jsdom (#29026)
Browse files Browse the repository at this point in the history
## Summary

This brings:
 - jest* up from 29.4.2 -> 29.7.0
 - jsdom up from 20.0.0 -> 22.1.0

While the latest version of jest-dom-environment still wants
`jsdom@^20.0.0`, it can safely use at least up to `jsdom@22.1.0`. See
jestjs/jest#13825 (comment) for
details.

Upgrading to latest versions lets us improve some WheelEvent tests and
will make it possible to test a much simpler FormData construction
approach (see #29018)

## How did you test this change?

Ran `yarn test` and `yarn test --prod` successfully
  • Loading branch information
jenseng committed May 8, 2024
1 parent b1d4096 commit 04b0588
Show file tree
Hide file tree
Showing 4 changed files with 979 additions and 912 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -137,6 +137,7 @@
"flags": "node ./scripts/flags/flags.js"
},
"resolutions": {
"react-is": "npm:react-is"
"react-is": "npm:react-is",
"jsdom": "22.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Expand Up @@ -4357,7 +4357,7 @@ describe('ReactDOMFizzServer', () => {
pipe(writable);
});
expect(window.getComputedStyle(document.body).backgroundColor).toMatch(
'blue',
'rgb(0, 0, 255)',
);
});

Expand Down Expand Up @@ -4386,7 +4386,7 @@ describe('ReactDOMFizzServer', () => {
pipe(writable);
});
expect(window.getComputedStyle(document.body).backgroundColor).toMatch(
'red',
'rgb(255, 0, 0)',
);
});
});
Expand Down
Expand Up @@ -65,11 +65,8 @@ describe('SyntheticWheelEvent', () => {
root.render(<div onWheel={onWheel} />);
});

let event = new MouseEvent('wheel', {
let event = new WheelEvent('wheel', {
bubbles: true,
});
// jsdom doesn't support these so we add them manually.
Object.assign(event, {
deltaX: 10,
deltaY: -50,
});
Expand All @@ -78,7 +75,7 @@ describe('SyntheticWheelEvent', () => {
event = new MouseEvent('wheel', {
bubbles: true,
});
// jsdom doesn't support these so we add them manually.
// jsdom doesn't support these legacy Webkit properties so we add them manually.
Object.assign(event, {
wheelDeltaX: -10,
wheelDeltaY: 50,
Expand Down Expand Up @@ -106,15 +103,15 @@ describe('SyntheticWheelEvent', () => {
});

container.firstChild.dispatchEvent(
new MouseEvent('wheel', {
new WheelEvent('wheel', {
bubbles: true,
deltaX: 10,
deltaY: -50,
}),
);

container.firstChild.dispatchEvent(
new MouseEvent('wheel', {
new WheelEvent('wheel', {
bubbles: true,
deltaX: 10,
deltaY: -50,
Expand Down

0 comments on commit 04b0588

Please sign in to comment.