I know there are a lot of threads about this, but I haven't been able to find nor understand any solutions regarding this particular case and alot of them refer to some type of Angular or other unrelated issue.
I am running node v6.5.0 and now npm 3.10.3 (yes, I read the bit about downgrading to a version prior to 3.10.6 to avoid u.id errors) for my ReactJS project. The problem is as soon as I introduced the x-editable library I am unable to run npm test
. Removing the library allows the karma test runner to run successfully. Although with the xeditable library I receive the following error:
to be executed: babel-node ./node_modules/karma/bin/karma start build/karma.conf
app:config Creating default configuration. +0ms
app:config Looking for environment overrides for NODE_ENV "test". +38ms
app:config No environment overrides found, defaults will be used. +5ms
app:webpack:config Create configuration. +715ms
app:webpack:config Apply ExtractTextPlugin to CSS loaders. +53ms
app:karma Create configuration. +1ms
START:
26 09 2016 22:13:30.442:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
26 09 2016 22:13:30.444:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
26 09 2016 22:13:30.539:INFO [launcher]: Starting browser PhantomJS
26 09 2016 22:13:30.987:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#yyxiFHE-r0V3e2a-AAAA with id 44774801
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
TypeError: undefined is not an object (evaluating 'a.fn.popover.Constructor')
at webpack:///src/lib/bootstrap-editable.min.js:1:0 <- tests/test-bundler.js:162134
Finished in 0.753 secs / 0 secs
SUMMARY:
✔ 0 tests completed
npm ERR! Test failed. See above for more details.
Any direction would be appreciated here, I am clueless. I read about some config options in the karma config files and webpack, but they didn't seem to help. I had just tried excluding/including the library explicitly or making sure it was part of the vendor files in webpack.
I figured this was a deps issue, but couldn't figure it why until now. Turns out I needed to add bootstrap.min.js file as a dependency for the x-editable plugin to work with the Karma test runner (didn't have to until the plugin was introduced).
Answered my own question here as well: https://github.com/vitalets/x-editable/issues/933