咕噜+量角器 - 任务"外壳:xvfb的"未找到 [英] Grunt + Protractor - Task "shell:xvfb" not found
问题描述
我试图用咕噜运行的Xvfb和我的量角器测试,但是当我执行我的任务量角器-xvfb的,我有这个回报率:
运行的任务:量角器-xvfb的警告:任务量角器-xvfb的不
找到。使用--force继续。
中止由于警告。
块引用>我Gruntfile.js:
\r\r\r\rmodule.exports =功能(呼噜声){\r
\r
\r
grunt.initConfig({\r
量角器:{\r
选项:{\r
KEEPALIVE:真实,\r
CONFIGFILE:protractor.conf.js\r
},\r
跑: {}\r
},\r
\r
贝壳: {\r
XVFB:{\r
命令:Xvfb来:99 -ac -screen 0 1600x1200x24',\r
选项:{\r
异步:真\r
}\r
}\r
},\r
ENV:{\r
XVFB:{\r
DISPLAY:'99'\r
}\r
}\r
\r
});\r
\r
\r
grunt.registerTask('量角器-xvfb的',[\r
贝:XVFB',\r
ENV:XVFB',\r
量角器:运行',\r
贝:XVFB:杀\r
]);\r
\r
// assim funciona\r
grunt.registerTask(测试,测试任务。',函数(){\r
grunt.log.writeln('Lorem存有悲坐阿梅德。');\r
});\r
\r
}\r
当我执行我的任务测试中,它是SUCESSFUL和我有这个回报率:
运行的任务:测试
运行测试任务Lorem存有悲坐阿梅德。
完成,没有错误。
块引用>OBS:我与量角器测试,而繁重的工作正常。返回:
完成了24.753秒
9的测试中,5断言,0失败
块引用>OBS2:我下面这个例子:从咕噜运行的Xvfb
解决方案我解决我的问题!
我所有的Gruntfile.js首先并不在我的项目的根目录,我需要它在项目的根目录接近的package.json加载插件我要运行这些测试。当我的Gruntfile.js是在错误的道路上,当我加入这些插件加载我的测试失败:
grunt.loadNpmTasks('咕噜壳重生');
grunt.loadNpmTasks('咕噜-ENV');
grunt.loadNpmTasks('咕噜-量角器亚军');失败消息:
注册咕噜壳重生本地NPM模块的任务。
>>本地NPM模块咕噜壳重生找不到。难道是安装?注册咕噜-ENV本地NPM模块的任务。
>>本地NPM模块咕噜-ENV找不到。难道是安装?注册咕噜-量角器亚军本地NPM模块的任务。
>>本地NPM模块咕噜-量角器亚军找不到。难道是安装?
加载Gruntfile.js任务... OK我删除了我所有的咕噜东西,我不得不再次安装并进行安装。
使用我Gruntfile在正确的道路我可能能够加载我插件和运行我的测试,咕噜+的Xvfb +量角器。
I'm trying to use grunt to run Xvfb and my protractor tests, but when I executed my Task protractor-xvfb, I've got this return:
Running tasks: protractor-xvfb Warning: Task "protractor-xvfb" not found. Use --force to continue.
Aborted due to warnings.
My Gruntfile.js:
module.exports = function(grunt) { grunt.initConfig({ protractor: { options: { keepAlive: true, configFile: "protractor.conf.js" }, run: {} }, shell: { xvfb: { command: 'Xvfb :99 -ac -screen 0 1600x1200x24', options: { async: true } } }, env: { xvfb: { DISPLAY: ':99' } } }); grunt.registerTask('protractor-xvfb',[ 'shell:xvfb', 'env:xvfb', 'protractor:run', 'shell:xvfb:kill' ]); // assim funciona grunt.registerTask('test', 'Test task.', function() { grunt.log.writeln('Lorem ipsum dolor sit amet.'); }); }
When I executed my Task test, it is sucessful and I've got this return:
Running tasks: test
Running "test" task Lorem ipsum dolor sit amet.
Done, without errors.
OBS: My tests with protractor without grunt is working fine. Return:
Finished in 24.753 seconds
9 tests, 5 assertions, 0 failures
OBS2: I'm following this example: Running Xvfb from Grunt
解决方案I solved my problem !
First of all My Gruntfile.js wasn't on my project root directory and I need it in project root directory close to package.json to load my plugins to run those tests. When my Gruntfile.js was on the wrong path when I added those plugin to load my test fails:
grunt.loadNpmTasks('grunt-shell-spawn'); grunt.loadNpmTasks('grunt-env'); grunt.loadNpmTasks('grunt-protractor-runner');
Fail message:
Registering "grunt-shell-spawn" local Npm module tasks. >> Local Npm module "grunt-shell-spawn" not found. Is it installed? Registering "grunt-env" local Npm module tasks. >> Local Npm module "grunt-env" not found. Is it installed? Registering "grunt-protractor-runner" local Npm module tasks. >> Local Npm module "grunt-protractor-runner" not found. Is it installed? Loading "Gruntfile.js" tasks...OK
I removed all my grunt stuff that I had install and installed again.
With my Gruntfile in the right path I could be able to load my plugins and run my tests with Grunt + Xvfb + Protractor.
这篇关于咕噜+量角器 - 任务"外壳:xvfb的"未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!