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

Wrong test path pattern from CLI args #5037

Closed
seanpoulter opened this issue Dec 8, 2017 · 1 comment · Fixed by #5066
Closed

Wrong test path pattern from CLI args #5037

seanpoulter opened this issue Dec 8, 2017 · 1 comment · Fixed by #5066

Comments

@seanpoulter
Copy link
Contributor

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

  1. When passing more than one --testPathPattern as command line arguments the test path pattern is wrong. The arg is typed as a string but multiple values mean the Array<string> is magically joined with , when the pattern is created by new RegExp(pattern, 'i').

    You can quickly see the pattern in the console by entering two paths that don't match:

    > jest aa bb
    ...
    Pattern: aa|bb
    
    > jest --testPathPattern=aa --testPathPattern=bb
    ...
    Pattern: aa,bb
    
  2. When passing a --testPathPattern and an unnamed argument, they're not joined together. Again from the console:

    > jest aa --testPathPattern=bb
    ...
    Pattern: bb
    

What is the expected behavior?
Looks like we should:

  • Update the arg type to be an Array<string>
  • Join multiple testPathPattern args with |
  • Join any testPathPattern args with the unnamed args

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

Jest: 21.2.1
Code: Looking at the head of the master branch
Found while adding tests for #3793

cpojer pushed a commit that referenced this issue Dec 12, 2017
…tern (#5066)

* Use all --testPathPattern and <regexForTestFiles> CLI args in testPathPattern

This fixes #5037.

* Add PR to CHANGELOG.md
@github-actions
Copy link

This issue 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 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant