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

chore: use vitest for type testing #2033

Merged
merged 8 commits into from
Mar 21, 2024

Conversation

KaiSpencer
Copy link
Contributor

closes #2019

@KaiSpencer
Copy link
Contributor Author

Hey @kettanaito,

I have made a first stab at this. Would it be possible for you to approve the workflow run so I can see if what I have done for the vitest config RE typescript versions is even remotely correct :D

@kettanaito kettanaito changed the title feat: migrate to vitest for type testing chore: use vitest for type testing Feb 12, 2024
globals: true,
typecheck: {
checker: 'tsc',
tsconfig: (() => {
Copy link
Member

Choose a reason for hiding this comment

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

This is so neat! Love it.

@@ -28,6 +28,6 @@ export default defineConfig({
* If any tests attempt to run during that window,
* they will fail, unable to resolve the "msw" import alias.
*/
singleThread: true,
poolOptions: { threads: { singleThread: true } },
Copy link
Member

Choose a reason for hiding this comment

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

👍 Good catch. I'm also considering moving away from this. We need this due to a single test packing the library. I want to introduce a new level of testing (that does the packing) and run it separately from the other tests. By doing so, we will finally be able to run Vitest in a watch mode, and also use multiple threads for the rest of the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds great, yeah this was needed with the vitest upgrade

@kettanaito
Copy link
Member

@KaiSpencer, looks like some of your changes were reflected in the pnpm-lock.yaml. Could you please run pnpm install and commit the changes to the lockfile? That should unblock the CI. Thanks.

@KaiSpencer
Copy link
Contributor Author

@KaiSpencer, looks like some of your changes were reflected in the pnpm-lock.yaml. Could you please run pnpm install and commit the changes to the lockfile? That should unblock the CI. Thanks.

I have done this and committed the lockfile, so should be good to go again on CI now

@KaiSpencer KaiSpencer marked this pull request as ready for review February 14, 2024 23:42
@KaiSpencer
Copy link
Contributor Author

Hey @kettanaito
I am happy with the type testing now. but there are some browser tests failing
msw-api/setup-worker/life-cycle-events/on.test.ts

It seems the response.url is returning back as an empty string. Not quite sure why :D Any ideas?

@kettanaito
Copy link
Member

@KaiSpencer, that's an unrelated issue (I think #2031).

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

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

This looks fantastic! Thank you so much, @KaiSpencer.

@kettanaito kettanaito merged commit fc44a2c into mswjs:main Mar 21, 2024
11 checks passed
@kettanaito
Copy link
Member

You, sir, are incredible. Thank you for making this happen and welcome to contributors, @KaiSpencer 👏

@KaiSpencer
Copy link
Contributor Author

You, sir, are incredible. Thank you for making this happen and welcome to contributors, @KaiSpencer 👏

Thank you for the support throughout this, It was a nice Issue/PR to get my foot in the door 🙇‍♂️

@kettanaito
Copy link
Member

If you see any other tasks that interest you, don't hesitate to leave a comment!

@KaiSpencer
Copy link
Contributor Author

I'll take a look 👀

@kettanaito
Copy link
Member

Released: v2.2.10 🎉

This has been released in v2.2.10!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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.

Use "assertType" from Vitest for type testing
2 participants