Ale*_*ada 5 javascript jasmine angularjs karma-jasmine
我的测试有问题,运行它们时出现此错误:
09 09 2015 14:55:27.174:INFO [Chrome 45.0.2454 (Mac OS X 10.10.1)]: Connected on socket 9aXAoBK8a1zKw9IVAAAA with id 22794373
Chrome 45.0.2454 (Mac OS X 10.10.1) ERROR
Uncaught ReferenceError: jasmineRequire is not defined
at /Users/agarcia/Projects/affiliate-suite/node_modules/karma/jasmine/lib/boot.js:15
Run Code Online (Sandbox Code Playgroud)
这是我的karma.conf.js文件:
/*global __dirname*/
// Karma configuration
var path = require('path');
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: __dirname,
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'node_modules/jasmine-core/lib/jasmine-core/jasmine.js',
'src/**/*.test.js'
],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'node_modules/jasmine-core/lib/jasmine-core/jasmine.js': ['webpack'],
'src/**/*.test.js': ['webpack']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-webpack')
]
});
};
Run Code Online (Sandbox Code Playgroud)
我已经安装了:
有什么线索吗?
阅读本文是找到解决此问题的关键:
http://jasmine.github.io/2.0/boot.html
它说jasmine.js并且jasmine-html.js必须在 之前加载boot.js,所以我所做的就是将它们按顺序排列,它根本不起作用,但我查看了 jasmine-core 文件夹,发现了一个名为 的文件,jasmine-core.js它以正确的顺序加载所有内容。
它工作完美!
| 归档时间: |
|
| 查看次数: |
5713 次 |
| 最近记录: |