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

Migrate type tests to Vitest #2129

Merged
merged 74 commits into from May 9, 2024

Conversation

aryaemami59
Copy link
Contributor

This PR:

  • Converts typetest.ts file extensions to test-d.ts to be compatible with Vitest.
  • Converts expectType() to either assertType() or expectTypeOf().toMatchTypeOf().
  • Converts expectExactType to expectTypeOf().toEqualTypeOf().
  • Converts lone-blocks to test or describe blocks.

Copy link

codesandbox-ci bot commented Feb 8, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

.github/workflows/test.yml Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
@markerikson
Copy link
Contributor

Haven't paid any attention to this, I'm afraid :) Where's it stand? I see green.

Also, just out of curiosity, what's the net benefit of doing typetests with Vitest?

@aryaemami59
Copy link
Contributor Author

@markerikson All tests are passing.

Also, just out of curiosity, what's the net benefit of doing typetests with Vitest?

  1. Type tests become more semantic and easier to read.
  2. We can take advantage of the type checking utilities Vitest provides.
  3. We can use the .skip/.only/.todo syntax.
  4. We can run both runtime and type tests by using the --typecheck flag.

On a side note I'm also a collaborator on the expect-type which is the library Vitest uses for type checking.

@markerikson
Copy link
Contributor

Okay, cloned it briefly and confirmed A) it passes locally, B) it does catch errors if I introduce them. Nice!

@markerikson markerikson merged commit a128c5e into reduxjs:master May 9, 2024
26 checks passed
@aryaemami59 aryaemami59 deleted the migrate-typetests-to-vitest branch May 9, 2024 01:15
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.

None yet

4 participants