Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Update @testing-library/jest-dom and remove old hack
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Aug 23, 2023
1 parent 8f1910c commit 1d0a393
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"sideEffects": false,
"dependencies": {
"@storybook/expect": "storybook-jest",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/jest-dom": "^6.1.0",
"@types/jest": "28.1.3",
"jest-mock": "^27.3.0"
},
Expand Down
13 changes: 1 addition & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ const expect = instrument(
{ intercept: (_method, path) => path[0] !== 'expect' }
).expect as unknown as Expect;

// @TODO: This should be reverted once https://github.com/testing-library/jest-dom/pull/438 is merged
// Some bundlers include an undefined `default` in the namespace import,
// or __esmodule (a boolean) which cause expect.extend to throw.
const validMatchers = { ...matchers };
Object.keys(validMatchers).forEach((matcherName) => {
const matcher = validMatchers[matcherName];
if (typeof matcher === 'undefined' || typeof matcher === 'boolean') {
delete validMatchers[matcherName];
}
});

expect.extend(validMatchers);
expect.extend(matchers);

export { expect, jest };
54 changes: 29 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ __metadata:
"@storybook/expect": storybook-jest
"@storybook/instrumenter": next
"@storybook/linter-config": ^3.1.2
"@testing-library/jest-dom": ^5.16.2
"@testing-library/jest-dom": ^6.1.0
"@types/jest": 28.1.3
"@types/react": "*"
auto: ^10.37.6
Expand Down Expand Up @@ -739,20 +739,33 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/jest-dom@npm:^5.16.2":
version: 5.17.0
resolution: "@testing-library/jest-dom@npm:5.17.0"
"@testing-library/jest-dom@npm:^6.1.0":
version: 6.1.0
resolution: "@testing-library/jest-dom@npm:6.1.0"
dependencies:
"@adobe/css-tools": ^4.0.1
"@babel/runtime": ^7.9.2
"@types/testing-library__jest-dom": ^5.9.1
aria-query: ^5.0.0
chalk: ^3.0.0
css.escape: ^1.5.1
dom-accessibility-api: ^0.5.6
lodash: ^4.17.15
redent: ^3.0.0
checksum: 9f28dbca8b50d7c306aae40c3aa8e06f0e115f740360004bd87d57f95acf7ab4b4f4122a7399a76dbf2bdaaafb15c99cc137fdcb0ae457a92e2de0f3fbf9b03b
peerDependencies:
"@jest/globals": ">= 28"
"@types/jest": ">= 28"
jest: ">= 28"
vitest: ">= 0.32"
peerDependenciesMeta:
"@jest/globals":
optional: true
"@types/jest":
optional: true
jest:
optional: true
vitest:
optional: true
checksum: e921886592554fd15f8a300a6cd94b2c4c688ef339a5cdde2c781f442dfd629ce1805b437bdec38830eea2190d18266e691085938d3a9ebe5bcad35f0c1413de
languageName: node
linkType: hard

Expand Down Expand Up @@ -931,16 +944,6 @@ __metadata:
languageName: node
linkType: hard

"@types/jest@npm:*, @types/jest@npm:>=26.0.0":
version: 29.5.4
resolution: "@types/jest@npm:29.5.4"
dependencies:
expect: ^29.0.0
pretty-format: ^29.0.0
checksum: 38ed5942f44336452efd0f071eab60aaa57cd8d46530348d0a3aa5a691dcbf1366c4ca8f6ee8364efb45b4413bfefae443e5d4f469246a472a03b21ac11cd4ed
languageName: node
linkType: hard

"@types/jest@npm:28.1.3":
version: 28.1.3
resolution: "@types/jest@npm:28.1.3"
Expand All @@ -951,6 +954,16 @@ __metadata:
languageName: node
linkType: hard

"@types/jest@npm:>=26.0.0":
version: 29.5.4
resolution: "@types/jest@npm:29.5.4"
dependencies:
expect: ^29.0.0
pretty-format: ^29.0.0
checksum: 38ed5942f44336452efd0f071eab60aaa57cd8d46530348d0a3aa5a691dcbf1366c4ca8f6ee8364efb45b4413bfefae443e5d4f469246a472a03b21ac11cd4ed
languageName: node
linkType: hard

"@types/json-schema@npm:^7.0.7":
version: 7.0.12
resolution: "@types/json-schema@npm:7.0.12"
Expand Down Expand Up @@ -1076,15 +1089,6 @@ __metadata:
languageName: node
linkType: hard

"@types/testing-library__jest-dom@npm:^5.9.1":
version: 5.14.9
resolution: "@types/testing-library__jest-dom@npm:5.14.9"
dependencies:
"@types/jest": "*"
checksum: d364494fc2545316292e88861146146af1e3818792ca63b62a63758b2f737669b687f4aaddfcfbcb7d0e1ed7890a9bd05de23ff97f277d5e68de574497a9ee72
languageName: node
linkType: hard

"@types/unist@npm:^2, @types/unist@npm:^2.0.0, @types/unist@npm:^2.0.2":
version: 2.0.7
resolution: "@types/unist@npm:2.0.7"
Expand Down

0 comments on commit 1d0a393

Please sign in to comment.