-
Notifications
You must be signed in to change notification settings - Fork 42
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
Upgrade vitest and some related packages #3482
base: main
Are you sure you want to change the base?
Conversation
|
Storybook demo / Chromatic80459281a | 91 components | 135 stories |
"exclude": [ | ||
"./src/**/*.test.ts", | ||
"./src/**/*.test.tsx", | ||
"./src/**/*.test-d.ts", | ||
"./src/**/*.stories.tsx" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to fix these errors:
Error: [@navikt/ds-react]: [1] src/modal/types.test-d.ts(4,1): error TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
[0] src/form/file-upload/utils/validate-files.test.ts(29,5): error TS2304: Cannot find name 'expect'. // multiple instances, just an example
src/tabs/Tabs.stories.tsx(7,1): error TS4082: Default export of the module has or is using private name 'TabsComponent'. // multiple instances, just an example
This could also be fixed by adding "types": ["vitest/globals"]
to compilerOptions, but maybe it's a good idea to exclude these files anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes type errors when using the matchers from @testing-library/jest-dom, e.g. Property 'toBeVisible' does not exist on type 'Assertion<HTMLElement>'
The docs says the old method should still work though 🤷♂️
https://github.com/testing-library/jest-dom/releases/tag/v6.0.0
@@ -2,6 +2,7 @@ | |||
"extends": "../../../tsconfig.json", | |||
"compilerOptions": { | |||
"noImplicitAny": false, | |||
"resolveJsonModule": true | |||
"resolveJsonModule": true, | |||
"types": ["vitest/globals"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes type errors when using test(), expect() etc, e.g. Cannot find name 'expect'.
Not sure why it wasn't needed before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed act()
from multiple tests because it gave this warning: The current testing environment is not configured to support act(...)
Tests seems to work fine without it 🤷♂️
No description provided.