当我尝试运行项目的业力测试套件(使用npm test或karma start)时,我得到以下输出:
> game-engine@0.1.0 test /home/kent/dev/html5/game-engine
> karma start karma.conf.js --browsers PhantomJS
16 11 2015 16:50:11.910:INFO [karma]: Karma v0.13.15 server started at http://localhost:9876/
16 11 2015 16:50:11.921:INFO [launcher]: Starting browser PhantomJS
16 11 2015 16:50:12.109:INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: Connected on socket opYF2pU3Qw-7rkdeAAAA with id 45780972
PhantomJS 1.9.8 (Linux 0.0.0) ERROR
TypeError: undefined is not a function!
at /home/kent/dev/html5/game-engine/node_modules/karma-babel-preprocessor/node_modules/babel-core/browser-polyfill.js:16
Finished in 0.12 secs / 0 secs
SUMMARY:
✔ 0 tests completed
npm ERR! Test failed. See above for more details.如果我查看上面提到的文件的第16行,它看起来与模块有关:
module.exports = function(it){ //// Line 16
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};整个文件可以在这里找到:http://pastebin.com/quHaY4NN
我使用以下版本:
$ node --version
v4.2.2
$ npm --version
2.14.7
$ karma --version
Karma version: 0.13.15我已经用头撞了好几个小时了。会是什么样的问题?我应该如何调试它呢?
发布于 2015-11-30 05:58:20
对我来说,解决方案是从karma-sinon-chai切换到替代的karma-chai-sinon模块。
两者的不同之处在于,后者将chai、sinon和sinon-chai作为sinon(允许用户选择使用这些版本的);其中前者将它们作为依赖项(特别是要sinon ~1.16.0,它有一个漏洞将setImmediate泄漏到全局范围,破坏了setImmediate的任何多填充)。
从您的问题中可以看出,您是否正在使用这些框架;但如果您正在使用这些框架,那么这对您来说也可能是一个解决方案。
https://stackoverflow.com/questions/33739629
复制相似问题