Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Fix vitest patch to work with portable stories and upgrade testing-library/jest-dom #25840

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions code/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/lib/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@storybook/instrumenter": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/jest-dom": "^6.4.0",
"@testing-library/user-event": "14.3.0",
"@vitest/expect": "1.1.3",
"@vitest/spy": "^1.1.3",
Expand Down
3 changes: 2 additions & 1 deletion code/lib/test/src/expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import {
} from '@vitest/expect';
import * as matchers from '@testing-library/jest-dom/matchers';
import type { PromisifyObject } from './utils';
import type { TestingLibraryMatchers } from '@testing-library/jest-dom/types/matchers';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to be translated as
import { TestingLibraryMatchers } from '@testing-library/jest-dom/types/matchers';
in dist/index.d.ts, which typescript can't parse right and causes it to be typed as any.

Can you replace this with
import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'
by any chance?


type Matchers<T> = PromisifyObject<JestAssertion<T>> &
matchers.TestingLibraryMatchers<ReturnType<ExpectStatic['stringContaining']>, Promise<void>>;
TestingLibraryMatchers<ReturnType<ExpectStatic['stringContaining']>, Promise<void>>;

// We only expose the jest compatible API for now
export interface Assertion<T> extends Matchers<T> {
Expand Down
55 changes: 51 additions & 4 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ __metadata:
languageName: node
linkType: hard

"@adobe/css-tools@npm:^4.3.2":
version: 4.3.3
resolution: "@adobe/css-tools@npm:4.3.3"
checksum: e76e712df713964b87cdf2aca1f0477f19bebd845484d5fcba726d3ec7782366e2f26ec8cb2dcfaf47081a5c891987d8a9f5c3f30d11e1eb3c1848adc27fcb24
languageName: node
linkType: hard

"@ampproject/remapping@npm:2.2.1, @ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1":
version: 2.2.1
resolution: "@ampproject/remapping@npm:2.2.1"
Expand Down Expand Up @@ -6663,7 +6670,7 @@ __metadata:
"@storybook/instrumenter": "workspace:*"
"@storybook/preview-api": "workspace:*"
"@testing-library/dom": "npm:^9.3.1"
"@testing-library/jest-dom": "npm:^6.1.3"
"@testing-library/jest-dom": "npm:^6.4.0"
"@testing-library/user-event": "npm:14.3.0"
"@vitest/expect": "npm:1.1.3"
"@vitest/spy": "npm:^1.1.3"
Expand Down Expand Up @@ -6925,7 +6932,7 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/jest-dom@npm:^6.1.3, @testing-library/jest-dom@npm:^6.1.4":
"@testing-library/jest-dom@npm:^6.1.4":
version: 6.1.5
resolution: "@testing-library/jest-dom@npm:6.1.5"
dependencies:
Expand Down Expand Up @@ -6955,6 +6962,39 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/jest-dom@npm:^6.4.0":
version: 6.4.0
resolution: "@testing-library/jest-dom@npm:6.4.0"
dependencies:
"@adobe/css-tools": "npm:^4.3.2"
"@babel/runtime": "npm:^7.9.2"
aria-query: "npm:^5.0.0"
chalk: "npm:^3.0.0"
css.escape: "npm:^1.5.1"
dom-accessibility-api: "npm:^0.6.3"
lodash: "npm:^4.17.15"
redent: "npm:^3.0.0"
peerDependencies:
"@jest/globals": ">= 28"
"@types/bun": "*"
"@types/jest": ">= 28"
jest: ">= 28"
vitest: ">= 0.32"
peerDependenciesMeta:
"@jest/globals":
optional: true
"@types/bun":
optional: true
"@types/jest":
optional: true
jest:
optional: true
vitest:
optional: true
checksum: 6b7eba9ca388986a721fb12f84adf0f5534bf7ec5851982023a889c4a0afac6e9e91291bdac39e1f59a05adefd7727e30463d98b21c3da32fbfec229ccb11ef1
languageName: node
linkType: hard

"@testing-library/react@npm:^11.2.2":
version: 11.2.7
resolution: "@testing-library/react@npm:11.2.7"
Expand Down Expand Up @@ -8479,12 +8519,12 @@ __metadata:

"@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch":
version: 1.1.3
resolution: "@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch::version=1.1.3&hash=5d51c9"
resolution: "@vitest/expect@patch:@vitest/expect@npm%3A1.1.3#~/.yarn/patches/@vitest-expect-npm-1.1.3-2062bf533f.patch::version=1.1.3&hash=8fb073"
dependencies:
"@vitest/spy": "npm:1.1.3"
"@vitest/utils": "npm:1.1.3"
chai: "npm:^4.3.10"
checksum: 426287f864f58b05b1c4689bc87b4ef2ca7b3316a22e8e42d94ee9c125cbc0caf294618c9a1201a8ddf8ab68ce1ab194d1e34589f7d608906a3dc679074cfe22
checksum: c3bbcae82050b7e92438c85e679ef2cb09162dc5638a10b3f0b5a8fc5600dfb0be578a244d84012ae2f1715748189393ac0fc72b891efff3503338221795ebe5
languageName: node
linkType: hard

Expand Down Expand Up @@ -12993,6 +13033,13 @@ __metadata:
languageName: node
linkType: hard

"dom-accessibility-api@npm:^0.6.3":
version: 0.6.3
resolution: "dom-accessibility-api@npm:0.6.3"
checksum: 10bee5aa514b2a9a37c87cd81268db607a2e933a050074abc2f6fa3da9080ebed206a320cbc123567f2c3087d22292853bdfdceaffdd4334ffe2af9510b29360
languageName: node
linkType: hard

"dom-converter@npm:^0.2.0":
version: 0.2.0
resolution: "dom-converter@npm:0.2.0"
Expand Down
Loading