-
-
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 displayName to MPR #4327
Add displayName to MPR #4327
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.
This is a game changer!
a few nits
" | ||
`; | ||
|
||
exports[`can pass projects or global config 5`] = ` | ||
"PASS project1/__tests__/file1.test.js | ||
"PASS BACKEND project1/__tests__/file1.test.js | ||
PASS UI project3/__tests__/file1.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.
this is probably going to fail when they're executed in different order. Previous test had identical lines (:
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.
Ohh, now I get this change that @thymikee was making for snapshots. Can we merge that one for the next alpha release? We can break the snapshot format for 21, and update the snapshot version. What do you think?
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'll rerecord snapshots in www
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.
do we have a mechanism to have multiple versions of snapshots at the same time? i remember we had this idea somewhere
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.
we should be able to decouple snapshot format changes from jest as a framework changes.
If jest update doesn't go well, rolling it back creates a huge mess in master because of all snapshot conflicts
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 is not the right place to have this conversation, I commented here: #4183 (comment) cc @thymikee
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.
@aaronabramov Should it be fine because it is using sortLines
?https://github.com/facebook/jest/blob/fbd07088383e456fae050ae03feaebd40de7dbf8/integration_tests/__tests__/multi_project_runner.test.js#L34-L40
types/Config.js
Outdated
@@ -15,7 +15,7 @@ export type HasteConfig = {| | |||
defaultPlatform?: ?string, | |||
hasteImplModulePath?: string, | |||
platforms?: Array<string>, | |||
providesModuleNodeModules: Array<string>, | |||
providesModuleNodeModules: Array<string> |
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.
what happened to the formatting?
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 was about to add that comment... this is what my Prettier config is formatting this file to... I'll double check if I have something wrong on my setup
`${status} ${formatTestPath(config, testPath)}` + | ||
(testDetail.length ? ` (${testDetail.join(', ')})` : '') | ||
`${status} ${projectDisplayName}${formatTestPath( | ||
projectConfig ? projectConfig : globalConfig, |
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.
i'm a little worried about that. Is this for resolving the relative test path?
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.
I'm not sure, but the behavior here should not change with this PR
Woohoo, this is awesome and @jkassens literally asked for this at FB just two hours ago. Here is my opinion on the UX:
Overall, the three answers all point to: be lenient with the user, and allow them to customize and control this behavior without Jest exerting too much control. |
just let it go haha 😃 what would be the strategy for emoji display name in non-terminal logs though? // jest.conf.js
{
displayName: isTTY ? 🦐 : 'i_like_underscores',
} |
Uh.. yeah this is kinda bad because the transform cache is dependent on the ProjectConfig, so if this value changes on different runs, the cache will be wiped. I definitely would like to support emoji though :P We could allow both a string and object value for displayName, and normalize to the object in the normalize.js file, and then have something like |
So we are going for |
I wonder if it is better if we flip it, so that we have |
yes for |
I think default + interactive works for me. I generally don't like negations in variable names. |
Possible follow-up PR: should we also print the display name in the test suite typeahead in watch mode? |
Got it, that makes sense! Integrating this with the typeaheads would be nice! |
@thymikee Maybe I'm missing something, but does |
@rogeliog nope :(. For now you'll have to declare just one, without the feedback for the other. |
@cpojer @aaronabramov given @thymikee's comment, should we start with just |
I'd go with |
I'm fine if we merge this first, and then make the change. @aaronabramov can you review this and merge it? You are the expert on this code. |
" | ||
`; | ||
|
||
exports[`can pass projects or global config 3`] = ` | ||
"PASS project1/__tests__/file1.test.js | ||
"PASS BACKEND project1/__tests__/file1.test.js | ||
PASS UI project3/__tests__/file1.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.
@aaronabramov There is a double space here... this happens in cases where we disable chalk
... because we are doing
chalk.someOptions(` ${displayName} `)
Should we remove those extra spaces when chalk is disabled?
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.
Yes, let's remove it in that case. Both on the left and right.
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.
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.
Here is the diff for removing the extra spaces in PASS
and FAIL
rogeliog/jest@add-display-name...rogeliog:add-display-name-full-diff (Still need some work to make sure it works with CI=true jest --color
)
@cpojer @aaronabramov I'm not sure if that leading space before PASS and the two after it are intentionally there in the current version or if it is fine to remove them? I'm fine with either I just wanted to understand if any of these current behavior was intentional... I'll update this PR after I get a better understanding on the expected behavior of non interactive non MPR output :) thanks!
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.
I think it's fine to remove them when colors are disabled.
Codecov Report
@@ Coverage Diff @@
## master #4327 +/- ##
==========================================
+ Coverage 55.85% 55.85% +<.01%
==========================================
Files 189 189
Lines 6383 6393 +10
Branches 6 6
==========================================
+ Hits 3565 3571 +6
- Misses 2815 2819 +4
Partials 3 3
Continue to review full report at Codecov.
|
Nice work @rogeliog, thank you! |
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
Fixes #4065
Adds the
displayName
option for multi project runnerPending items
displayName
Test plan
I have some questions regarding the UX for this:
What happens when some of the projects have
displayName
and some don't do we simply show the name for some and leave it empty for the rest? Or doesdisplayName
need to be present in either all or none of the projects?What happens when the displayName of the project is really long, or not all caps, or with spaces? Do we normalize the
diplayName
to all caps no spaces?Do we allow non alpha numeric characters like emojis?