5
我已经写了可用于后端和客户端噶:找不到变量:出口
(exports || window).Bar= (function() {
return function() { .... }
})();
现在我的人缘测试使用PhantomJs和埋怨不存在exports
变量既是一个节点模块
gulp.task('test', function() {
var karma = require('karma').server;
karma.start({
autoWatch: false,
browsers: [
'PhantomJS'
],
coverageReporter: {
type: 'lcovonly'
},
frameworks: [
'jasmine'
],
files: [
'bar.js',
'tests/bar.spec.js'
],
junitReporter: {
outputFile: 'target/junit.xml'
},
preprocessors: {
'app/js/!(lib)/**/*.js': 'coverage'
},
reporters: [
'progress',
'junit',
'coverage'
],
singleRun: true
});
});
我得到的错误是
PhantomJS 1.9.7 (Mac OS X) ERROR
ReferenceError: Can't find variable: exports
有没有忽略出口瓦里的方式能在卡拉姆/ phantomsJs?
但实际上OP代码的问题是什么? – 2014-10-05 19:57:27
看看这个SO回答:http://stackoverflow.com/questions/4725603/variable-undefined-vs-typeof-variable-undefined – MarcoL 2014-10-05 20:45:58