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

Negation does not work with testMatch option #6440

Closed
caseyWebb opened this issue Jun 11, 2018 · 1 comment · Fixed by #6648
Closed

Negation does not work with testMatch option #6440

caseyWebb opened this issue Jun 11, 2018 · 1 comment · Fixed by #6648

Comments

@caseyWebb
Copy link

caseyWebb commented Jun 11, 2018

🐛 Bug Report

The documentation for the testMatch option indicates that any micromatch patterns are valid, however negation does not appear to work.

See the micromatch package for details of the patterns you can specify.

https://facebook.github.io/jest/docs/en/configuration.html#testmatch-array-string

To Reproduce

  • Create two test files, __tests__/test.js and __tests__/test.noop.js. Fill with a placeholder test.
  • Set testMatch in jest config to "testMatch": ["**/__tests__/*.js", "!**/*.noop.js"]
  • Run jest

A minimal repo to repoduce is provided here

Expected behavior

With the steps above, test.noop.js should not be executed, but it is.

Link to repl or repo (highly encouraged)

https://github.com/caseyWebb/jest-negation-bug

(note, to confirm this is valid micromatch, you can run the match.js file in that repo (node match.js)

Run npx envinfo --preset jest

Paste the results here:

npx: installed 1 in 0.846s
(node:22743) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of null
    at a.run.then.e (/home/casey/.npm/_npx/22743/lib/node_modules/envinfo/dist/cli.js:2:96634)
    at <anonymous>
(node:22743) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22743) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

...not much help (fyi, this is on Linux).

Jest is 23.1.0
Node is 9.11.1

@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 12, 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