-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 testNamePattern CLI argument #1733
Conversation
testNamePattern allows filtering tests by name with a regex
@DmitriiAbramov is working on that separately. |
@@ -91,6 +91,11 @@ const options = { | |||
'rare.', | |||
type: 'boolean', | |||
}, | |||
testNamePattern: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we give this an alias? Maybe p
or t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe t
? I would reserve p
for filtering by path, because it means that in the watch mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added:
--testNamePattern, -t Run only tests with a name that matches the
regex pattern. [string]
This is awesome! Nice work and thanks for adding an integration test. My only comment is whether we should add an alias for this, given that no one will want to write |
The new integration test did not pass on Windows. Most of the existing integration tests seem to have |
yes please |
Current coverage is 90.17% (diff: 100%)@@ master #1733 diff @@
==========================================
Files 31 31
Lines 1170 1170
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 1055 1055
Misses 115 115
Partials 0 0
|
Great work. Thank you for helping make Jest better for everyone :) |
* Add testNamePattern CLI argument testNamePattern allows filtering tests by name with a regex * Add -t as an alias for --testNamePattern * Skip testNamePattern-test integration test on Windows
* Add testNamePattern CLI argument testNamePattern allows filtering tests by name with a regex * Add -t as an alias for --testNamePattern * Skip testNamePattern-test integration test on Windows
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. |
Summary
The
--testNamePattern <regex>
argument (alias-t <regex>
) allows running only tests with a name that matches a given regex pattern. Fixes #1662.Test plan
Added an integration test in
integration_tests/__tests__/testNamePattern-test.js
.