-
Notifications
You must be signed in to change notification settings - Fork 451
Update front-end testing dependencies to current versions and switch to mocha reporter #3218
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
Conversation
fda5dff to
de20bda
Compare
h/browser/chrome/karma.config.js
Outdated
| .require('phantom-ownpropertynames/implement', {entry: true}); | ||
| // fix for Proxyquire in PhantomJS 1.x. | ||
| // See https://github.com/bitwit/proxyquireify-phantom-menace | ||
| .require('../../../node_modules/phantom-ownpropertynames/implement', |
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 there a reason this has changed to a path rather than a package name?
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.
Something changed in how the require() is resolved here with the dependency upgrade, with the result that the path is always resolved relative to the location of the karma.config.js file rather than using the normal Node require resolution algorithm. I haven't dug into the upgraded modules to find out exactly what caused the issue.
However, reading this again it occurred to me that using require.resolve('phantom-ownpropertynames/implement') would be a neater that hard-coding the relative location of the node_modules folder.
6508e0d to
68e8c66
Compare
Current coverage is 73.89%@@ master #3218 diff @@
==========================================
Files 125 125
Lines 4649 4649
Methods 0 0
Messages 0 0
Branches 551 551
==========================================
Hits 3435 3435
Misses 1131 1131
Partials 83 83 |
Update test and development dependencies to latest versions from npm, except for PhantomJS. The PhantomJS 1.9.x -> 2.x transition requires additional changes in tests. A couple of issues came up during the upgrade: - 'constructor' is no longer a valid name for describe() blocks - The require() in Karma's Browserify config ended up being resolved relative to the location of karma.config.js for reasons I haven't debugged, instead of looking in node_modules/. Using require.resolve() to get the absolute path works around the issue.
This produces more helpful output when test assertions involving deep equality checks fail. See https://www.npmjs.com/package/karma-mocha-reporter#showdiff This requires karma-mocha >= v0.2.2
When running tests in `gulp watch` mode, the initial run passed but subsequent changes resulted in an error in the `merge-descriptors` package, related to PhantomJS. I haven't looked deeply into the problem but it does look like a familiar issue related to Proxyquire trying to 'call through' to the original imports in the module. Adding the '@noCallThru' flag in guest-test.coffee resolves the issue.
…f option is enabled
68e8c66 to
74d76f8
Compare
|
LGTM. |
Two commits here, the first updates the front-end testing dependencies (Karma, mocha, chai, sinon etc.) to current npm versions. The exception is that PhantomJS remains at 1.9.x because the upgrade to PhantomJS 2.x resulted in bunch of test failures and will require more work to finish off.
The second switches from the default 'dots' reporter to 'karma-mocha-reporter', which produces output that is easier to read and more helpful when test assertions fail. See https://www.npmjs.com/package/karma-mocha-reporter#showdiff