question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

testMatch not working as expected

See original GitHub issue

🐛 Bug Report

The regex is not working as I expected within testMatch argument.

To Reproduce

Steps to reproduce the behavior:

I thought I was passing the argument incorrectly via CLI so I started messing with the defaults in jest itself and found something odd.

If I change the default testMatch to this, it still works: testMatch: ['**/?(*.)+(test).js'],

If I change it to this, it finds no tests: testMatch: ['**/?(*.)+test.js'],

Expected behavior

I would expect this to work, without adding a capturing group

In [REMOVED]
  107 files checked.
  testMatch: **/?(*.)+test.js - 0 matches
  testPathIgnorePatterns: /node_modules/ - 107 matches
Pattern:  - 0 matches

Link to repl or repo (highly encouraged)

N/A

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS High Sierra 10.13.3
    CPU: x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  Binaries:
    Node: 8.10.0 - /usr/local/bin/node
    npm: 6.1.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^23.3.0 => 23.4.0 

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

testMatch doesn't glob as expected · Issue #7108 · facebook/jest
i'm setting up jest's testMatch config, but it doesn't glob as expected. my ... I too have problems with the testMatch globbing.
Read more >
Jest No Tests found - Stack Overflow
I wrote a test, not in the specific folder and follow a naming convention *.test.js and change testMatch "testMatch": [ "<rootDir>/src/**/*.
Read more >
Jest — Filenames without test or spec | by Damian Myerscough
js file as a test file and run the tests within that file. I used the following command to achive this. ❯ jest...
Read more >
Configuring Jest
Please keep in mind that the resulting configuration must be JSON-serializable. When using the --config option, the JSON file must not contain a...
Read more >
Test Match Playing Conditions - ESPNcricinfo
Play shall not take place on more than 5 days. ... subject to there being 6 hours scheduled for play per day (Pakistan...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found