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

Fix reporters' config #6542

Merged
merged 7 commits into from
Aug 16, 2018
Merged

Fix reporters' config #6542

merged 7 commits into from
Aug 16, 2018

Conversation

artola
Copy link
Contributor

@artola artola commented Jun 25, 2018

Summary

Fix reporters to handle string params

Documentation shows reporters as reporters [array<moduleName | [moduleName, options]>], the code was incorrectly handling the following cases:

reporters: ['default', 'someother']
// and/or
reporters: [['default', {}], 'someother']

This fix, re-use the already existing _getReporterProps to compare {path} === 'default'.

Test plan

Regression test. See: https://github.com/artola/jest/blob/8f446d46f527e39cc3ac9adbd41a7403d3bc6a23/packages/jest-cli/src/__tests__/test_scheduler.test.js#L30

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@codecov-io
Copy link

codecov-io commented Jun 25, 2018

Codecov Report

Merging #6542 into master will increase coverage by 0.12%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6542      +/-   ##
==========================================
+ Coverage   63.43%   63.56%   +0.12%     
==========================================
  Files         235      235              
  Lines        9115     9114       -1     
  Branches        3        3              
==========================================
+ Hits         5782     5793      +11     
+ Misses       3332     3320      -12     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-cli/src/TestScheduler.js 44.27% <33.33%> (+5.92%) ⬆️
packages/jest-config/src/normalize.js 91.33% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25a69f4...8cb41d3. Read the comment docs.

@artola artola closed this Jun 25, 2018
@artola artola reopened this Jun 25, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@artola artola changed the title Artola patch 1 Fix reporters' config Jun 25, 2018
@SimenB SimenB requested a review from thymikee August 15, 2018 13:38
@SimenB
Copy link
Member

SimenB commented Aug 15, 2018

@artola sorry about the lack of feedback here. Could you rebase it to fix the conflicts? The code itself LGTM, but I haven't really been in this part of the code base before

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Documentation shows reporters as `reporters [array<moduleName | [moduleName, options]>]`, the code was incorrectly handling the following cases:

```
// no `string` moduleName
// _addCustomReporters(reporters: Array<ReporterConfig>)
reporters: ['default', 'someother']

// _shouldAddDefaultReporters(reporters?: Array<ReporterConfig>): boolean {
reporters: [['default', {}], 'someother']
```

This fix, use  the already existing `_getReporterProps` to compare `{path} === 'default'`.
- config for reporters supports `default`
@aaronabramov
Copy link
Contributor

i'm not sure why flow didn't catch that, but the code makes total sense!
i generally don't like testing the code this way, because we're passing invalid partial data structures to the class. These tests are really far from the real world and flow will freak out once we enable it for this file :)

@aaronabramov aaronabramov merged commit 9737621 into jestjs:master Aug 16, 2018
@@ -123,6 +123,7 @@
- `[expect]` `toEqual` no longer tries to compare non-enumerable symbolic properties, to be consistent with non-symbolic properties. ([#6398](https://github.com/facebook/jest/pull/6398))
- `[jest-util]` `console.timeEnd` now properly log elapsed time in milliseconds. ([#6456](https://github.com/facebook/jest/pull/6456))
- `[jest-mock]` Fix `MockNativeMethods` access in react-native `jest.mock()` ([#6505](https://github.com/facebook/jest/pull/6505))
- `[jest-cli]` Fix `reporters` for `moduleName` = `'default'` ([#6542](https://github.com/facebook/jest/pull/6542))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be higher up (under master)

@github-actions
Copy link

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.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants