Gruntjs 使用grunt量角器在grunt中发送规范

Gruntjs 使用grunt量角器在grunt中发送规范,gruntjs,protractor,specs,runner,Gruntjs,Protractor,Specs,Runner,我正在使用grunt量角器运行插件,在量角器目标中,我想发送包含要运行的测试的specs参数。 在grunt文件中,我的目标如下所示: testIntegration: { options: { args: { specs: ['test1.js'], browser: 'firefox' } } 量角器父任务选项包含量角器配置文件的设置 运行此目标时,我遇到以下错误: $grunt量角器:鉴定 运行“量角器:测试”(量角器)任务 正在启动se

我正在使用grunt量角器运行插件,在量角器目标中,我想发送包含要运行的测试的specs参数。 在grunt文件中,我的目标如下所示:

testIntegration: 
{
  options: 
  {
    args: {
      specs: ['test1.js'],
      browser: 'firefox'
  } 
}
量角器父任务选项包含量角器配置文件的设置

运行此目标时,我遇到以下错误: $grunt量角器:鉴定 运行“量角器:测试”(量角器)任务 正在启动selenium独立服务器。。。 Selenium独立服务器启动于。。。 警告:模式t与任何文件都不匹配。 警告:模式e与任何文件都不匹配。 警告:模式s与任何文件都不匹配。 警告:模式t与任何文件都不匹配。 警告:模式1与任何文件都不匹配。 警告:模式j与任何文件都不匹配。 警告:模式s与任何文件都不匹配

还有一些错误。 同一行在量角器配置文件中工作良好。 尝试了一些其他的变化,但没有成功


我错过了什么?有什么想法吗?

试试这个配置:

module.exports = function(grunt) {

  // Project configuration
  grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  protractor: {
    options: {
      keepAlive: true,
      singleRun: false,
      configFile: "PROTRACTOR_CONFIG_FILE.js"
    },
    run_firefox: {
      options: {
        args: {
          browser: "firefox"
        }
      }
    }
  });

  // load grunt-protractor-runner
  grunt.loadNpmTasks('grunt-protractor-runner');

  // register tasks
  grunt.registerTask('default', 'Run Protractor using Firefox',
    ['protractor:run_firefox']);
};
有趣的是,如果你阅读每一条错误消息,它都会拼出“test1.js”。看起来它没有正确读取配置文件,可能是因为您没有使用grunt.file.readJSON('FILENAME.json')