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
Issue #774: Adding support to location array #843
Conversation
Codecov Report
|
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.
Thanks!
Codecov is complainig about low coverage of the config.js
itself, not your changes, they are fine — “The diff coverage is 100%.”
loaders/utils/getComponentFiles.js
Outdated
@@ -21,6 +22,8 @@ module.exports = function getComponentFiles(components, rootDir, ignore) { | |||
let componentFiles; | |||
if (isFunction(components)) { | |||
componentFiles = components(); | |||
} else if (isArray(components)) { |
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.
Use Array.isArray
.
scripts/__tests__/config.spec.js
Outdated
@@ -35,12 +36,36 @@ it('should accept config as an object', () => { | |||
expect(result).toMatchObject({ title: 'Style guide' }); | |||
}); | |||
|
|||
it('should accept components as a 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.
These tests don’t add much (if any) value: you’re testing this line:
type: ['string', 'function', 'array'],
which is already tested in config sanitizer tests.
@@ -94,6 +94,34 @@ it('should return correct component paths: function returning absolute paths', ( | |||
expect(result).not.toMatch(`'filepath': 'components/RandomButton/RandomButton.js'`); | |||
}); | |||
|
|||
it('should return correct component paths: function returning absolute paths', () => { |
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.
function returning absolute paths → array of component absolute paths.
You can also add a test for relative paths.
🎉 This issue has been resolved in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi,
This is my first time contributing, so let me know if I've done it correctly and how can I help with other issues. I've committed some changes to ./loades/utils/getComponentFiles.js, but not sure how to test it properly so codecov decreased a little. Can I follow the same pattern in styleguideloader.spec.js to get this part covered?
Thanks!