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

Add --ignoreProjects CLI argument to ignore test suites by project name #12620

Merged
merged 13 commits into from
Apr 4, 2022

Conversation

F3n67u
Copy link
Contributor

@F3n67u F3n67u commented Mar 31, 2022

Summary

Add --ignoreProjects CLI argument to ignore test suites by project name

close #12618

Test plan

@F3n67u F3n67u changed the title Add --ignoreProjects CLI argument to ignore test suites by project … Add --ignoreProjects CLI argument to ignore test suites by project name Mar 31, 2022
docs/CLI.md Outdated Show resolved Hide resolved
@F3n67u F3n67u marked this pull request as ready for review April 1, 2022 05:04
@mrazauskas
Copy link
Contributor

Just thinking out loud. I am fine with the implementation, only not so sure if word ignore is describing the option well?

What about --omitProjects? Or perhaps --skipProjects? (A pair of --onlyProjects and --skipProjects might be a good choice, but perhaps that is unnecessary change.)

@F3n67u
Copy link
Contributor Author

F3n67u commented Apr 1, 2022

Just thinking out loud. I am fine with the implementation, only not so sure if word ignore is describing the option well?

What about --omitProjects? Or perhaps --skipProjects? (A pair of --onlyProjects and --skipProjects might be a good choice, but perhaps that is unnecessary change.)

@mrazauskas I will vote for --ignoreProjects. jest already has an --testPathIgnorePatterns cli option. ignoreProjects will make cli option more consistent.

and ignore is used a lot more than the skip word in the javascript community. for example:

  1. https://eslint.org/docs/user-guide/command-line-interface#--ignore-pattern
  2. https://prettier.io/docs/en/cli.html#--ignore-path

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks, I like it! can you add a changelog entry as well?

@@ -224,6 +224,10 @@ This feature is an escape-hatch. If Jest doesn't exit at the end of a test run,

Show the help information, similar to this page.

### `--ignoreProjects <project1> ... <projectN>`
Copy link
Member

Choose a reason for hiding this comment

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

what happens if both this and selectProjects is used? Ideally it should be a configuration error. (and be mentioned in the docs)

Copy link
Contributor Author

@F3n67u F3n67u Apr 1, 2022

Choose a reason for hiding this comment

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

selectProjects and ignoreProjects could be used together. now it seems no need to do it because we don't support glob pattern, but I think to allow them to be used together will be better (not include a breaking change) because we maybe support glob in both selectProjects and ignoreProjects. just as Typescript allows you to use include and exclude together.

and I don't think there is any reason to restrict our user to use them together, If they like to, we will allow them to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see how our user's opinion here: #12618 (comment)

Copy link

Choose a reason for hiding this comment

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

@F3n67u Glob support for both would be awesome as well, especially if you're using https://github.com/jest-community/jest-runner-eslint so you could do ignore *-test when running tests and ignore *-lint when running lint.

Copy link
Member

Choose a reason for hiding this comment

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

Mind opening up a separate feature request?

Copy link

Choose a reason for hiding this comment

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

Sure!

});
});

describe('when Jest is started with `--selectProjects first-project second-project --ignoreProjects first-project` ', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SimenB here is the test for using --selectProjects and --ignoreProjects together.

@F3n67u
Copy link
Contributor Author

F3n67u commented Apr 1, 2022

thanks, I like it! can you add a changelog entry as well?

done.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks!

@SimenB SimenB merged commit eb2146f into jestjs:main Apr 4, 2022
@F3n67u F3n67u deleted the ignoreProjects branch April 5, 2022 01:43
@SimenB
Copy link
Member

SimenB commented Apr 5, 2022

@github-actions
Copy link

github-actions bot commented May 8, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: ignoreProjects counterpart to selectProjects
5 participants