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

fix(typecheck): run both runtime and typecheck tests if typecheck.include overlaps with include #6256

Merged
merged 19 commits into from
Aug 13, 2024

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Aug 1, 2024

Fixes #6151
Fixes #4766
Fixes #5019

Description

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@sheremet-va sheremet-va changed the title fix(typecheck): correctly run both runtime and typecheck tests if typecheck.include overlaps with include fix(typecheck): correctly run both runtime and typecheck tests if typecheck.include overlaps with include Aug 1, 2024
Copy link

netlify bot commented Aug 1, 2024

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 66fbed3
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/66ab7866d96e820008c09429
😎 Deploy Preview https://deploy-preview-6256--vitest-dev.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.

Copy link

netlify bot commented Aug 1, 2024

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit db49551
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/66bb165a3b0a0600080d9146
😎 Deploy Preview https://deploy-preview-6256--vitest-dev.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.

@AlexPaven
Copy link

When this is done, will it still be true that test.each, for example, will not be able to be typechecked? If I have some tests that use test.each, will this mean no tests will be run if I enable typecheck? (this is what happens now, I get Unhandled Rejection: Error: test.each syntax is not supported when testing types)

Awesome to see this looked at, I was just today looking for something exactly like this!

@sheremet-va
Copy link
Member Author

sheremet-va commented Aug 1, 2024

When this is done, will it still be true that test.each, for example, will not be able to be typechecked? If I have some tests that use test.each, will this mean no tests will be run if I enable typecheck? (this is what happens now, I get Unhandled Rejection: Error: test.each syntax is not supported when testing types)

Awesome to see this looked at, I was just today looking for something exactly like this!

Yes, it will still throw an error. Dynamic test names cannot be evaluated with a static typecheck. You can specify a glob pattern for tests that don't have .each in typecheck.include or typecheck.exclude for tests that have .each

@sheremet-va sheremet-va changed the title fix(typecheck): correctly run both runtime and typecheck tests if typecheck.include overlaps with include fix(typecheck): run both runtime and typecheck tests if typecheck.include overlaps with include Aug 12, 2024
@sheremet-va sheremet-va force-pushed the fix/typecheck-overwrite branch 2 times, most recently from 5dd2471 to dbac2c8 Compare August 12, 2024 20:49
@sheremet-va
Copy link
Member Author

@AlexPaven typechecker doesn't throw an error now, but it prints a warning every time the compiler encounters an issue (I need to write more tests for that) with a code frame. This can be disabled with ignoreCollectWarnings.

Typechecker tests are now displayed alongside the runtime tests, the test results are not merged together. This is incredibly hard to do because we need to reset the state every time the test reruns, but it's possible that typechecking will be finished faster than the test starts running.

@sheremet-va sheremet-va force-pushed the fix/typecheck-overwrite branch from 0b7f139 to 6173593 Compare August 13, 2024 08:09
@sheremet-va sheremet-va merged commit 153ff01 into vitest-dev:main Aug 13, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants