Skip to content

Conversation

@robertknight
Copy link
Contributor

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

.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',
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@robertknight robertknight force-pushed the karma-test-deps-update branch from 6508e0d to 68e8c66 Compare April 26, 2016 12:01
@codecov-io
Copy link

codecov-io commented Apr 26, 2016

Current coverage is 73.89%

Merging #3218 into master will not change coverage

@@             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          

Sunburst

Powered by Codecov. Last updated by 75ed17c

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.
@robertknight robertknight force-pushed the karma-test-deps-update branch from 68e8c66 to 74d76f8 Compare April 26, 2016 12:03
@nickstenning
Copy link
Contributor

LGTM.

@nickstenning nickstenning merged commit dfac3a7 into master Apr 27, 2016
@nickstenning nickstenning deleted the karma-test-deps-update branch April 27, 2016 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants