Javascript 使用PhantomJS而不是Chrome时,Karma会失败
我使用Karma Chrome启动器时通过了一系列测试,但使用Karma PhantomJS启动器时失败 这是我的karma.config.js文件中的内容 ``` 框架:['browserify'、'mocha'、'chai'、'sinon']Javascript 使用PhantomJS而不是Chrome时,Karma会失败,javascript,reactjs,phantomjs,karma-runner,browserify,Javascript,Reactjs,Phantomjs,Karma Runner,Browserify,我使用Karma Chrome启动器时通过了一系列测试,但使用Karma PhantomJS启动器时失败 这是我的karma.config.js文件中的内容 ``` 框架:['browserify'、'mocha'、'chai'、'sinon'] files: require('./include.conf.js').concat([ 'test/helper/*.js', 'test/example/*.spec.js', 'test/unit/*.spec.js', 'tes
files: require('./include.conf.js').concat([
'test/helper/*.js',
'test/example/*.spec.js',
'test/unit/*.spec.js',
'test/integration/*.spec.js'
]),
// list of files to exclude
exclude: [
'gulpfile.js',
'index.js',
'karma.conf.js'
],
browserify: {
debug: true,
transform: ['reactify'],
bundleDelay: 1000
},
preprocessors: {
'test/helper/*.js': ['browserify'],
'test/example/*.spec.js': ['browserify'],
'test/unit/*.spec.js': ['browserify'],
'test/integration/*.spec.js': ['browserify'],
'dev/js/**/*.js': ['browserify']
},
// web server port
port: 9876,
autoWatch: true,
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
plugins: [
'karma-coverage',
'karma-mocha',
'karma-browserify',
'karma-chai',
'karma-sinon',
'karma-phantomjs-launcher'
]```
所有文件都在使用Karma Chrome Launcher进行预处理并正常运行,但当我尝试使用PhantomJS运行它们时,会出现如下错误:
PhantomJS 1.9.8(Mac OS X 0.0.0)错误
ReferenceError:找不到变量:require
at/Users/edwinlin/Documents/repos/Picarus/dev/js/utils/database-utils.js:1
谢谢任何人的帮助