- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Migrating vitest
to SDK
#1672
Migrating vitest
to SDK
#1672
Changes from 1 commit
c07dba8
80bee93
f0f82ec
0d36295
6af28e5
5eb6e53
e2efa42
dc83123
ba3e9bf
317eedf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import matchers from '@testing-library/jest-dom/matchers' | ||
import { expect } from 'vitest' | ||
import { afterEach } from 'vitest' | ||
import { cleanup } from '@testing-library/react' | ||
import '@testing-library/jest-dom/vitest' | ||
|
||
expect.extend(matchers) | ||
// runs a clean after each test case (e.g. clearing jsdom) | ||
afterEach(() => { | ||
cleanup(); | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { afterEach } from 'vitest' | ||
infomiho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { cleanup } from '@testing-library/react' | ||
import '@testing-library/jest-dom/vitest' | ||
|
||
// runs a clean after each test case (e.g. clearing jsdom) | ||
afterEach(() => { | ||
cleanup(); | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ | |
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"outDir": "dist", | ||
"allowJs": true | ||
"allowJs": true, | ||
"types": ["@testing-library/jest-dom"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There were type errors related to the unit test matchers e.g. |
||
// todo(filip): Only works with common js, see https://www.typescriptlang.org/tsconfig#paths and daily-article. | ||
// "paths": { | ||
// "@wasp/*": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/.wasp/ | ||
/.env.server | ||
/.env.client | ||
/node_modules/ | ||
node_modules/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vitest creates some cache files in the |
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.
I've updated the
vitest
and all the accompanying libraries to the latest versions. I did this because there was an error with usingjsx
files from deps (in our case our SDK) which would mean we would need to bundle our SDK forvitest
to work again.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.
Running with the latest versions seems to work fine 👍