grunt-protractor-coverage icon indicating copy to clipboard operation
grunt-protractor-coverage copied to clipboard

More than one config file specified.

Open F1LT3R opened this issue 10 years ago • 3 comments

Everything seems to work fine, until protractor_coverage starts up from within grunt.

I can run protractor outside of grunt and everything is fine. But from grunt I get this...

grunt --debug
Running "protractor_coverage:local" (protractor_coverage) task
[D] Task source: /Users/username/repos/grunt-protractor-coverage-example/node_modules/grunt-protractor-coverage/tasks/protractor_coverage.js
Collector started on port 3001
Usage: protractor [options] [configFile]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
See the reference config for a full list of options.

Options:
  --help                                             Print Protractor help menu
  --version                                          Print Protractor version
  --browser, --capabilities.browserName              Browsername, e.g. chrome or firefox
  --seleniumAddress                                  A running selenium address to use
  --seleniumServerJar                                Location of the standalone selenium jar file
  --seleniumPort                                     Optional port for the selenium standalone server
  --baseUrl                                          URL to prepend to all relative paths
  --rootElement                                      Element housing ng-app, if not html or body
  --specs                                            Comma-separated list of files to test
  --exclude                                          Comma-separated list of files to exclude
  --verbose, --jasmineNodeOpts.isVerbose             Print full spec names
  --stackTrace, --jasmineNodeOpts.includeStackTrace  Print stack trace on error
  --params                                           Param object to be passed to the tests
  --framework                                        Test framework to use: jasmine, cucumber or mocha
  --resultJsonOutputFile                             Path to save JSON test result
  --troubleshoot                                     Turn on troubleshooting output

Error: more than one config file specified
>>
>> Test failed but keep the grunt process alive.
Shutdown requested

Done, without errors.

Here is my Gruntfile:

module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  grunt.initConfig({

    express: {
      options: {
        port: 9000,
        base: 'instrumented'
      },
      cov: {
        options: {
          script: 'instrumented/src/file1.js',
          debug: true
        }
      },
    },
    open: {
      server: {
        url: 'http://localhost:9000'
      }
    },


    copy: {
      cov: {
        files: [{
          expand: true,
          dot: true,
          src: 'src/*.js',
          dest: 'instrumented',
        }]
      }
    },

    // start - code coverage settings
    instrument: {
      files: ['src/file1.js'],
      options: {
        // lazy: false,
        lazy: true,
        basePath: 'instrumented'
      }
    },


    protractor_coverage: {
      options: {
        configFile: 'protractor.conf.js',
        keepAlive: true,
        noColor: false,
        coverageDir: 'instrumented',
      },
      local: {
        options: {
          args: {
            baseUrl: 'http://localhost:3000/',
            'browser': 'chrome'
          }
        }
      }
    },


    makeReport: {
      src: 'instrumented/*.json',
      options: {
        type: 'html',
        dir: 'reports/',
        // print: 'detail'
        //        type: 'lcov',
        //        dir: 'reports',
        //        print: 'detail'
      }
    },

  });

  grunt.registerTask('default', [
    // 'copy:cov',
    // 'instrument',
    // 'express:cov',
    'protractor_coverage:local',
    // 'protractor_coverage',
    // 'makeReport'
  ]);
};

You can see the rest of my code here:

My code is here: https://github.com/F1LT3R/grunt-protractor-coverage-example

I would be interested to see if you know what is wrong here. I've been trying to solve this problem on and off for days now.

F1LT3R avatar Feb 04 '15 11:02 F1LT3R

Something fishy is going on, at first I could reproduce your problem, but after I installed the Selenium jars with node_modules/protractor/bin/webdriver-manager update I got other problems, which I also can`t reproduce anymore, despite a fresh git clone/checkout.

Anyway pay attention to your inconsisted usage of the server port:

  • connect start server on 3000,
  • protractor gets the baseUrl localhost:9000 and
  • in your test you do a browser.driver.get('http://0.0.0.0:3000'); (use browser.driver.get('/') if you define a baseUrl)

Hope this helps.

robertgroh avatar Feb 26 '15 12:02 robertgroh

Thanks @weemonger will check this out later.

F1LT3R avatar Feb 26 '15 12:02 F1LT3R

I have this issue when running grunt with the --debug flag. Without the --debug flag everything runs fine.

bitsthatmatter avatar Apr 15 '15 14:04 bitsthatmatter