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

feat: add --exclude CLI flag #4279

Merged
merged 25 commits into from
Dec 19, 2023
Merged

Conversation

Namchee
Copy link
Contributor

@Namchee Namchee commented Oct 9, 2023

Description

This pull request adds a new flag --exclude as a CLI option that allows users to specify extra glob patterns to be ignored from tests. By default, it will merge the globs with existing default excludes.

Closes #4148

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

@netlify
Copy link

netlify bot commented Oct 9, 2023

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit f6da69f
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/65819a7a84444f00080cd70e

@Namchee Namchee marked this pull request as ready for review October 10, 2023 13:12
Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

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

It would also be nice if you can provide a test case for this feature. I don't think we have tests specifically for CLI commands, but you can create one.

packages/vitest/src/node/cli.ts Outdated Show resolved Hide resolved
@Namchee
Copy link
Contributor Author

Namchee commented Oct 23, 2023

Good idea, will create a test for CLIs later.

@Namchee
Copy link
Contributor Author

Namchee commented Oct 29, 2023

@sheremet-va , I think I have difficulties creating the CLI test since I don't know how to access the config from the running vitest instance. Do you have a pointer regarding this?

Alternatively, we can just provide test for resolveConfig since the merging logic happens there.

@sheremet-va
Copy link
Member

I think I have difficulties creating the CLI test since I don't know how to access the config from the running vitest instance. Do you have a pointer regarding this?

You can see an example of a CLI test in #4399

packages/vitest/src/node/config.ts Outdated Show resolved Hide resolved
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.

Allow to exclude test files with cli
2 participants