Sunday, April 9, 2017

How to debug an error on PhantomJS with karma + webpack?

Leave a Comment

I'm running karma using Chrome and PhantomJS as browsers. With Chrome, I get no errors; with PhantomJS I get this:

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR   TypeError: undefined is not a constructor (evaluating 'action(dstObject[propName], srcObject[propName])')   at webpack:///~/my-library/dist/my-library.full.js:94:0 <- index.js:10919  PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 SUCCESS (0 secs / 0 secs) TOTAL: 0 SUCCESS 

Basically, my tests are not running because of something going on with my-library, which is a node dependency. My question is this: how can I debug this error?

I'm calling karma with karma start test/unit/karma.conf.js and there I can see that the files:['./index.js'], when I look in this file I see this:

// require all test files (files that ends with .spec.js) const testsContext = require.context('./specs', true, /\.spec$/) testsContext.keys().forEach(testsContext) 

require.context is a webpack function which creates a context loading my spec files, which are returned by testsContext.keys() but this is as far as I've been able to go.

I would appreciate any ideas to understand what is actually going on.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment