Skip to content

feat(vitest): add new CLI options #5163

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

Merged
merged 3 commits into from
Feb 10, 2024

Conversation

sheremet-va
Copy link
Member

Description

This PR adds a few easy-to-justify options to the CLI:

  • --hookTimeout
  • --teardownTimeout
  • --slowTestThreshold
  • --maxConcurrency
  • --no-cache
  • --cache.dir

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
Copy link
Member Author

@AriPerkkio do you think we should add watermarks to CLI options? With the new transform option we can define it as --coverage.watermarks=10,30 for example

Copy link

netlify bot commented Feb 9, 2024

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit 92983c4
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65c742308399db0008dba263
😎 Deploy Preview https://deploy-preview-5163--fastidious-cascaron-4ded94.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.

@sheremet-va sheremet-va added this to the 1.3.0 milestone Feb 9, 2024
@AriPerkkio
Copy link
Member

do you think we should add watermarks to CLI options? With the new transform option we can define it as --coverage.watermarks=10,30 for example

If supporting it is not too difficult, then sure let's add it. So --coverage.watermarks.lines=10,20 --coverage.watermarks.functions=10,20 should be merged into:

{
  statements: [50, 80], // Default value
  functions: [10, 20],
  branches: [50, 80],   // Default value
  lines: [10, 20]
}

@sheremet-va
Copy link
Member Author

f supporting it is not too difficult, then sure let's add it. So --coverage.watermarks.lines=10,20 --coverage.watermarks.functions=10,20 should be merged into:

Do we need to merge them ourselves? Right now you can pass down lines and function in the config file and watermarks is not resolved to the full object.

@AriPerkkio
Copy link
Member

Do we need to merge them ourselves?

Oh right - we don't need to worry about the defaults. Istanbul will merge these automatically with the default ones. So --coverage.watermarks.lines=10,20 --coverage.watermarks.functions=10,20 should produce following config in Vitest's perspective:

{
 functions: [10, 20],
 lines: [10, 20]
}

Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

Looks good! The test cases in cli-test.test.ts are perfect. This is something we've been missing from CLI option testing for a long time.

@sheremet-va sheremet-va merged commit 4e17942 into vitest-dev:main Feb 10, 2024
@sheremet-va sheremet-va deleted the feat/new-options branch February 10, 2024 10:53
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.

2 participants