react-redux icon indicating copy to clipboard operation
react-redux copied to clipboard

Migrate type tests to Vitest

Open aryaemami59 opened this issue 1 year ago • 1 comments

This PR:

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

aryaemami59 avatar Feb 08 '24 09:02 aryaemami59

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.

codesandbox-ci[bot] avatar Feb 08 '24 09:02 codesandbox-ci[bot]

Deploy Preview for react-redux-docs ready!

Name Link
Latest commit d69e108d827dac3ef5fe2fad7eb1901c1e1bd2dd
Latest deploy log https://app.netlify.com/sites/react-redux-docs/deploys/661276573120920008cb9427
Deploy Preview https://deploy-preview-2129--react-redux-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 10 '24 04:03 netlify[bot]

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?

markerikson avatar May 02 '24 00:05 markerikson

@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.

aryaemami59 avatar May 02 '24 01:05 aryaemami59

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

markerikson avatar May 09 '24 01:05 markerikson