-
-
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
Make --listTests return a new line separated list when not using --json #4229
Conversation
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.
Rogelio's back!
@aaronabramov I didn't see #4212... Do you think this would play well with it? |
Seems like this one is failing the tests, mind fixing it? |
@@ -12,10 +12,17 @@ | |||
const runJest = require('../runJest'); | |||
|
|||
describe('--listTests flag', () => { | |||
it('causes tests to be printed out as JSON', () => { | |||
it('causes tests to be printed in different lines', () => { | |||
const {status, stdout} = runJest('list_tests', ['--listTests']); | |||
|
|||
expect(status).toBe(0); | |||
expect(() => JSON.parse(stdout)).not.toThrow(); |
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.
this assertion does'n seem to be correct any more, since it's not a JSON object now.
we should do something like:
expect(stdout.split('\n')).toHaveLength(1);
expect(stdout).toMatch('whatever.the.name.of.the.test.is.test.js');
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.
Yeah, I just added something similar but by snapshotting the output.. hope that is fine
@rogeliog i closed $4212 for now, we'll rethink the approach in the future, so i t should not be a problem |
Btw, given that we are now using |
@@ -0,0 +1,8 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
|
|||
exports[`--listTests flag causes tests to be printed in different lines 1`] = ` |
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.
that's even better! <3
Oh, it seems that it is now failing because the tests ran in a different order... maybe I can remove that second dummy test file |
@rogeliog split by |
…on (jestjs#4229) * Make `--listTests` return a new line separated list when not using `--json` * Fix tests * Sort dummy test files
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
#4214
This makes
--listTests
play better with tools likegrep
Test plan