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

Upgrade vitest and some related packages #3482

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

HalvorHaugan
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Dec 23, 2024

⚠️ No Changeset found

Latest commit: c9d8487

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Dec 23, 2024

Storybook demo / Chromatic

80459281a | 91 components | 135 stories

Comment on lines +11 to +16
"exclude": [
"./src/**/*.test.ts",
"./src/**/*.test.tsx",
"./src/**/*.test-d.ts",
"./src/**/*.stories.tsx"
]
Copy link
Contributor Author

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?

Copy link
Contributor Author

@HalvorHaugan HalvorHaugan Dec 23, 2024

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"]
Copy link
Contributor Author

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.

Copy link
Contributor Author

@HalvorHaugan HalvorHaugan Dec 23, 2024

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 🤷‍♂️

@HalvorHaugan HalvorHaugan changed the title Upgrade some dependencies Upgrade vitest and some related packages Dec 23, 2024
@HalvorHaugan HalvorHaugan marked this pull request as ready for review December 23, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant