Skip to content

Commit

Permalink
chore(jest)!: add support for jest v29 (#309)
Browse files Browse the repository at this point in the history
* chore(jest)!: add support for jest v29

Add support for Jest v29.

Jest v29 drops support for Node v12/v17, so I've updated the
package.json to contain the same Node support as Jest.

The only other major breaking change in Jest v29 is that the default
snapshot format has changed slightly, but that only changes the stored
jest snapshots slighty (see https://jestjs.io/blog/2022/08/25/jest-29).

BREAKING CHANGE: Drop support for Node v12 and Node v17,
                 as Jest v29 does not support these versions.

* ci(release): use Node v16 for release action

Node v16 is the current active LTS release of Node.JS

Co-authored-by: Jamie King <[email protected]>

Co-authored-by: Jamie King <[email protected]>
  • Loading branch information
aloisklink and 10xLaCroixDrinker authored Nov 3, 2022
1 parent 916e76f commit 79e53fc
Show file tree
Hide file tree
Showing 7 changed files with 650 additions and 640 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '10.x', '12.x', '14.x', '16.x' ]
node: [ '14.x', '16.x', '18.x' ]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
- name: Install dependencies
run: npm ci
- name: Release
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Thanks `jest-image-snapshot`, that broken header would not have looked good in p
npm i --save-dev jest-image-snapshot
```

Please note that `Jest` `>=20 <=27` is a peerDependency. `jest-image-snapshot` will **not** work with anything below Jest 20.x.x
Please note that `Jest` `>=20 <=29` is a peerDependency. `jest-image-snapshot` will **not** work with anything below Jest 20.x.x

### Invocation

Expand Down
2 changes: 1 addition & 1 deletion __tests__/__snapshots__/diff-snapshot.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`diff-snapshot diffImageToSnapshot should throw an error if an unknown threshold type is supplied 1`] = `"Unknown failureThresholdType: banana. Valid options are \\"pixel\\" or \\"percent\\"."`;
exports[`diff-snapshot diffImageToSnapshot should throw an error if an unknown threshold type is supplied 1`] = `"Unknown failureThresholdType: banana. Valid options are "pixel" or "percent"."`;
4 changes: 2 additions & 2 deletions __tests__/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ exports[`toMatchImageSnapshot dumpInlineDiffToConsole uses Inline Image Protocol
`;

exports[`toMatchImageSnapshot passes diffImageToSnapshot everything it needs to create a snapshot and compare if needed 1`] = `
Object {
{
"allowSizeMismatch": false,
"blur": 0,
"comparisonMethod": "pixelmatch",
"customDiffConfig": Object {},
"customDiffConfig": {},
"diffDir": undefined,
"diffDirection": "horizontal",
"failureThreshold": 0,
Expand Down
1,270 changes: 640 additions & 630 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Jest matcher for image comparisons. Most commonly used for visual regression testing.",
"main": "src/index.js",
"engines": {
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"scripts": {
"lint": "eslint ./ --ignore-path .gitignore --ext .js",
Expand Down Expand Up @@ -53,8 +53,8 @@
"eslint-config-amex": "^7.0.0",
"husky": "^4.2.1",
"image-size": "^0.8.3",
"jest": "^28.0.3",
"jest-snapshot": "^28.0.3",
"jest": "^29.0.0",
"jest-snapshot": "^29.0.0",
"lockfile-lint": "^4.0.0",
"mock-spawn": "^0.2.6",
"semantic-release": "^17.0.4"
Expand All @@ -71,7 +71,7 @@
"ssim.js": "^3.1.1"
},
"peerDependencies": {
"jest": ">=20 <=28"
"jest": ">=20 <=29"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit 79e53fc

Please sign in to comment.