我正在尝试使用http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/生成的项目从Grunt运行Karma/Jasmine
Karma推出PhantomJS(或Chrome),并且根据singleRun,它要么超时要么只是坐在那里什么都不做.我尝试过改变captureTimeout并browserNoActivityTimeout基于阅读有类似问题的人的解决方案,但它似乎没有用.
我的相关pacakge版本等:
我在OS X上发现有同样问题的人:
我已经尝试将所有dev依赖项更新到最新版本,但问题仍然存在.
我的控制台输出如下.引用bundle的webpack行现在是VALID/INVALID令人担忧,但我找不到任何关于它们含义的信息.这是我的控制台输出:
Running "karma:unit" (karma) task
DEBUG [config]: autoWatch set to false, because of singleRun
DEBUG [plugin]: Loading karma-* from /home/ed/workspace/wwb-app/node_modules
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-coffee-preprocessor.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-html2js-preprocessor.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin /home/ed/workspace/wwb-app/node_modules/karma-requirejs. …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Jasmine设置Karma来运行AngularJS单元测试,但我无法运行测试.我确定我忽视了一些简单的事情.我正在通过Node.js安装和安装karma 的Windows 7机器上运行它npm.
我的目录结构如下所示:
- js/app/ - 包含控制器,应用程序等
- js/config/ - 包含karma.conf.js
- js/lib/ - 包含angular
- js/test/ - 包含茉莉花规格
我正在js目录中启动命令提示符并运行此命令:
karma start config/karma.conf.js
这导致Chrome在端口9876上运行,但每当我更改任何监视文件并检查Karma输出时,我都会看到以下信息消息:
No captured browser, open http://localhost:9876/
这是我的配置文件:
module.exports = function(config) {
config.set({
basePath: '../',
frameworks: ['jasmine'],
files: [
'lib/angular.js',
'app/**/*.js',
'test/**/*.js'
],
exclude: [
],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
captureTimeout: 60000,
singleRun: false
});
};
Run Code Online (Sandbox Code Playgroud)
我正在使用Angular 1.2.10和Karma 0.10.9
我在我的项目和业力中使用了AngularJS进行测试.然后我像这样配置了业力:
config.set({
basePath: '../',
frameworks: ['jasmine'],
files: [
// bower:js
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
'js/**/*.js',
'test/spec/**/*.js'
],
browsers: [
'PhantomJS'
],
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine'
],
port: 8890
})
Run Code Online (Sandbox Code Playgroud)
并且像这样咕:
grunt.initConfig({
connect: {
testserver: {
options: {
base: 'js/',
hostname: 'localhost',
port: '8889'
}
}
},
karma: {
unit: {
configFile: './test/karma-unit.conf.js',
singleRun: true
}
}
});
grunt.registerTask('test', ['connect', 'karma:unit']);
Run Code Online (Sandbox Code Playgroud)
当我输入'grunt test'时,控制台显示phantomjs无法启动:
Running "connect:testserver" (connect) task
Started connect web server on http://localhost:8889
Running "karma:unit" …Run Code Online (Sandbox Code Playgroud)