Closed G-Rath closed 1 month ago
@gnapse would it be possible to have this reviewed? as currently all typescript types are broken meaning we've having to patch this manually for our CIs to pass 😅
@all-contributors please add @G-Rath for code
@gnapse
I've put up a pull request to add @G-Rath! :tada:
:tada: This PR is included in version 6.6.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
This change results in the following:
Error: src/components/SiteNav/SiteNav.test.tsx(59,22): error TS2339: Property 'toHaveAttribute' does not exist on type 'Assertion<HTMLElement>'.
Error: src/components/SiteNav/SiteNav.test.tsx(60,22): error TS2339: Property 'toHaveTextContent' does not exist on type 'Assertion<HTMLElement>'.
Error: src/components/SiteNav/SiteNav.test.tsx(84,22): error TS2339: Property 'toHaveClass' does not exist on type 'Assertion<HTMLElement>'.
Error: src/components/SiteNav/SiteNav.test.tsx(88,18): error TS2339: Property 'toHaveClass' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/App.test.tsx(19,66): error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/components/CollapsibleContent.test.tsx(46,60): error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/components/CollapsibleContent.test.tsx(48,37): error TS2339: Property 'toBeVisible' does not exist on type 'Assertion<HTMLDivElement>'.
Error: src/tests/components/CollapsibleContent.test.tsx(68,30): error TS2339: Property 'toHaveClass' does not exist on type 'Assertion<HTMLDivElement>'.
Error: src/tests/components/CollapsibleContent.test.tsx(71,62): error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/components/CollapsibleContent.test.tsx(75,33): error TS2339: Property 'toBeVisible' does not exist on type 'Assertion<HTMLElement | null>'.
Error: src/tests/components/CollapsibleContent.test.tsx(90,18): error TS2339: Property 'toHaveClass' does not exist on type 'Assertion<Element | null>'.
Error: src/tests/components/CollapsibleContent.test.tsx(111,33): error TS2339: Property 'toHaveClass' does not exist on type 'Assertion<HTMLElement | null>'.
Error: src/tests/components/DownloadLink.test.tsx(21,18): error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/components/DownloadLink.test.tsx(22,18): error TS2339: Property 'toHaveAttribute' does not exist on type 'Assertion<HTMLElement>'.
Error: src/tests/components/DownloadLink.test.tsx(23,18): error TS2339: Property 'toHaveAttribute' does not exist on type 'Assertion<HTMLElement>'.
@G-Rath can you look into it? I have no access to an environment with jest-dom and vitest right now.
FWIW I'm not seeing the errors @BR0kEN- is - the change is working well for me (and I had the issue @G-Rath had with jest-dom
and vitest
before).
Thanks for the fast reply and apologies, I had to not post that before a little of research.
I had no @testing-library/jest-dom
added to the compilerOptions.types
of the tsconfig.json
and it worked. After this change, which is logical, it stopped. Fortunately, the fix is easy.
What:
Replaces the dynamic lookup of the return type of
expect.stringContaining
with the underlying typeWhy:
This resolves the TypeScript errors introduced by #612, as described in #629
How:
By replacing the use of
expect.stringContaining
with a concrete type - I don't actually know whyReturnType
was being used in the first place given thatexpect.stringContaining
has a return type ofany
and I don't really see that changing anytime in the future.Checklist:
Resolves #632 Resolves #629