-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use nyc over istanbul-cli #316
Conversation
also add cross-env + babel-plugin-istanbul for better coverage reports
Can you elaborate more on why we should change our coverage method? What's different about |
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.
Additionally, please remove yarn.lock. Airbnb does not use yarn, and lockfiles are harmful in non-top-level-apps.
.editorconfig
Outdated
@@ -0,0 +1,16 @@ | |||
root = true |
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.
unless this file can be kept in sync with CI (ie, changes to it will cause misformatted files to fail) i'd prefer the file not be included.
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 have found EditorConfig to be very helpful as a maintainer because it takes care of nuisances with whitespace and line endings and newlines etc. behind the scenes. e.g. the IntelliJ platform comes with support built in and almost all popular editors have a simple installer. It's worth noting that GitHub also has native support.
If you still prefer it not be added, I will remove it.
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'd love to have it, but something in CI would need to enforce it (the linter typically does this for us). Do you know of anything that can do that?
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.
https://github.com/jedmao/eclint looks promising!
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.
But I don't feel like it's a strong enough win for you, if it must be enforced like this.
I will remove it from this PR since it's not really the main focus. 馃毑 馃彔 painted.
test/components/CalendarDay_spec.jsx
Outdated
@@ -30,7 +30,7 @@ describe('CalendarDay', () => { | |||
expect(wrapper.text()).to.equal(lastOfMonth.format('D')); | |||
}); | |||
|
|||
it('contains arbitrary content if renderDay is provided', () => { | |||
it.skip('contains arbitrary content if renderDay is provided', () => { |
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.
just noting this line will need reverting before merging
@@ -0,0 +1,5 @@ | |||
--compilers js:babel-register,jsx:babel-register |
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 good change regardless; i'd be stoked to merge it in a separate PR :-)
test/mocha.opts
Outdated
--require airbnb-js-shims | ||
--require ./test/_helpers/ignoreSVGStrings.jsx | ||
--recursive | ||
test/**/*_spec.js test/**/*_spec.jsx test/_helpers/restoreSinonStubs.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.
however, the glob part of this configuration should remain in package.json, not in the mocha opts.
It's preferred over the istanbul cli because
|
package.json
Outdated
"pretest": "npm run --silent lint", | ||
"tests-only": "npm run mocha --silent test", | ||
"tests-only": "mocha --silent", |
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 the file path needs to be restored here?
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 was a typo on my part - the --recursive
flag handles the globs for us.
@ljharb mind elaborating on
If you publish with a |
If I publish a shrinkwrap file, yarn ignores it. If I publish a yarn lock file, yarn and npm ignore it. In no case am I ensuring my users get a deterministic dep tree. However, I am ensuring that if an in-range update is published that breaks me, my own tests will merrily pass but my users will merrily break. Only an app is in the position to truly know that dependencies should be frozen. |
Curiouser and curiouser
Mind elaborating on that? edit: or do you have a slack channel I can bug you on so I can stop digressing here? 馃槃 |
@JaKXz i'm on a number of common slacks and on freenode IRC, but here's fine too. Basically, the absolute worst case of forgetting to include a new file in |
I see. That's a reasonable approach to safety. Anyway, are there any other changes you want to see in this PR? |
@ljharb what do we need to do to get this merged in? |
test/mocha.opts
Outdated
@@ -0,0 +1,4 @@ | |||
--compilers js:babel-register,jsx:babel-register | |||
--require airbnb-js-shims | |||
--require ./test/_helpers/ignoreSVGStrings.jsx |
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 fails to include the file that restores sinon stubs; please revert this part and restore npm run mocha
, and have that pass the file there. mocha
doesn't work with global before/after handlers if they're --require
d in.
99b5dd4
to
5338446
Compare
@JaKXz i've rebased this branch; but it seems like your previous command ( Is this not something |
5338446
to
5c26650
Compare
@ljharb sorry for the long turnaround on this! I think I've addressed your concerns now. :) I'm not sure why Travis isn't firing but I can confirm the tests pass locally. |
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.
Awesome, thanks!
Just three more comments/questions, and assuming tests pass, I think this is good to go!
I appreciate your persistence with the back-and-forth and the many comments; I've switched to using nyc on another project and it's both a smooth and pleasant upgrade from istanbul-cli.
package.json
Outdated
"lint": "eslint --ext .js,.jsx src test", | ||
"mocha": "mocha --compilers js:babel-register,jsx:babel-register --require airbnb-js-shims --recursive ./test/_helpers", | ||
"mocha": "mocha ./test/_helpers test/**/*_spec.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.
is the _spec.js
part needed? Every JS file inside test
should be considered a test, and double-running the helpers shouldn't be a problem :-/
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.
fixed.
package.json
Outdated
"pretest": "npm run --silent lint", | ||
"tests-only": "npm run mocha --silent test", | ||
"tests-only": "npm run mocha -- --silent", |
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.
the --silent
was intended for npm
, not mocha
- this change passes it to mocha
instead. Can this line be reverted?
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.
fixed.
.nycrc
Outdated
], | ||
"all": true, | ||
"check-coverage": true, | ||
"statements": 89, |
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.
just one final re-confirmation - are these numbers exactly in line with our current coverage? If not, can we bump them to be? :-)
5c26650
to
0f9ffc9
Compare
@ljharb here are the original watermarks, and I've dropped the numbers in Also addressed your other two comments. Thanks for your patience as well! |
Party! Why did coveralls coverage go down so significantly though? |
Because the instrumentation is much more accurate now, and we are measuring against all JS and jsx files :) which I don't think was happening before. |
29f774c
to
797468f
Compare
I've just re-rebased and pushed up; if travis-ci passes (even if coveralls drops) then this is good to merge 馃帀 |
797468f
to
5bdcdc4
Compare
Coveralls passed which probably means the thresholds aren't high enough; but I'm going to merge this now! |
(I filed #417 to combine coverage across all test runs, instead of just on node 4.6) |
Thanks @JaKXz! 馃帀 |
Thanks y'all! @ljharb, I lowered the threshold so all following prs wouldn't be breaking, but yes, i agree that they are too low.
|
馃憢 Hi!
istanbuljs
member here -Thought I'd help out a little by simplifying your coverage commands and configuration :)
Otherwise, the main win of bringing you over to the much better supported
nyc
+babel-plugin-istanbul
is that you're now getting more accurate coverage reports and stats!Please let me know if anything concerns you - very happy to answer any questions you might have. Thanks again for this wonderful library!