Javascript Grunt找不到mocha浏览器测试
我将学习本教程: 这是我的grunt文件:Javascript Grunt找不到mocha浏览器测试,javascript,gruntjs,mocha.js,bower,Javascript,Gruntjs,Mocha.js,Bower,我将学习本教程: 这是我的grunt文件: // Gruntfile.js module.exports = function(grunt){ grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //Mocha mocha: { all: { src: ['tests/spec.html'] }
// Gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//Mocha
mocha: {
all: {
src: ['tests/spec.html']
},
options: {
run: true,
reporter: 'Spec',
growlOnSuccess: false
}
}
});
//Load grunt mocha task
grunt.loadNpmTasks('grunt-mocha')
grunt.registerTask('default', ['mocha']);
};
除了本指南建议的内容外,我还设置了以下内容:
ran bower init inside of the tests folder.
generating the following:
"description": "",
"main": "",
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
我完成了这项工作,因为在运行该命令之前,没有找到测试
当我从命令行运行grunt时,我得到以下结果:
测试:tests/spec.html
0通过(0毫秒)
0通过!(0.00s)
下面是spec.html页面和webspec.js页面以及单元测试的要点:
感谢您提供的任何帮助 我做了更多的研究,发现
https://github.com/shellscape/mocha-chrome
我能够将其配置为在命令行中运行浏览器测试。
然后,我使用另一个名为Concurrent的npm包同时运行单元测试和浏览器测试