-
-
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
fix: make sure normalize accepts defaults #7742
Conversation
@@ -200,7 +200,9 @@ const normalizeCollectCoverageFrom = (options: InitialOptions, key: string) => { | |||
value = JSON.parse(options[key]); | |||
} catch (e) {} | |||
|
|||
Array.isArray(value) || (value = [options[key]]); | |||
if (value && !Array.isArray(value)) { |
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.
it ended up being [null]
, which threw below in the loop.
Also, super weird to use ||
then assignment...
|
||
describe('Defaults', () => { | ||
it('should be accepted by normalize', () => { | ||
normalize({...Defaults, rootDir: '/root'}, {}); |
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.
rootDir
is added by readConfig
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.
Might want to preserve that information 😄
normalize({...Defaults, rootDir: '/root'}, {}); | |
// rootDir is added by readConfig | |
normalize({...Defaults, rootDir: '/root'}, {}); |
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 don't see a reason, it's used like this all over this test file
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.
One nit to address, other than that looks good, thanks for a little cleanup!
f9ad1b9
to
28e1361
Compare
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.
LGTM
|
||
describe('Defaults', () => { | ||
it('should be accepted by normalize', () => { | ||
normalize({...Defaults, rootDir: '/root'}, {}); |
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.
Might want to preserve that information 😄
normalize({...Defaults, rootDir: '/root'}, {}); | |
// rootDir is added by readConfig | |
normalize({...Defaults, rootDir: '/root'}, {}); |
28e1361
to
9904a83
Compare
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 #7741
Test plan
Test added