r3b / grunt-protractor-coverage

Coverage analysis for Protractor tests
Apache License 2.0
38 stars 29 forks source link

More than one config file specified. #36

Open F1LT3R opened 9 years ago

F1LT3R commented 9 years ago

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.

robertgroh commented 9 years ago

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:

Hope this helps.

F1LT3R commented 9 years ago

Thanks @weemonger will check this out later.

bitsthatmatter commented 9 years ago

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