Piyush Jajoo
Piyush Jajoo

Reputation: 1093

jasmineNodeOpts: Unexpected identifier error while executing protractor protractorConfig.js

This is my config.js file -

//server config information
var serverConfig=require('./serverConfig.js').serverConfig;


var $browser= serverConfig.$browser;

//got the browser name
process.argv.forEach(function (val, index) {
  if(val==='-browser'){
    $browser=process.argv[index+1];
  }
});

// !!! update the server config
serverConfig.$browser=  $browser;

 //config
 //browser.driver.manage().timeouts().setScriptTimeout(TIME_OUT);

// The main suite of Protractor tests.
exports.config = {
  seleniumServerJar: '../../selenium/selenium-server-standalone-2.37.0.jar',
  chromeDriver: '../../selenium/chromedriver.exe',

  seleniumAddress: serverConfig.SELENIUMN_ADDRESS,

  // Spec patterns are relative to this directory.
     specs: [
'../e2e/Regression/CreateOperatorViewFromViewManagement.js' 
    ],


  capabilities: {
    'browserName': $browser
  },
  onPrepare:'../prepareStartup.js',

  //When the angular bootstrap not from the <html></html>
  rootElement: 'body>div',

  baseUrl: serverConfig.BASE_URL 

  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
  }
};

I get this error when I try to execute my tests using this config.js file -

C:\TRUNK\tests\func\gui\protractor\config\protractorConfig.js:60
  jasmineNodeOpts: {
  ^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at ConfigParser.addFileConfig (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\configParser.js:139:20)
    at Object.init (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\launcher.js:59:7)
    at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\cli.js:118:23)
    at Module._compile (module.js:456:26)

When I execute protractor --help I get following options -

Options:
  --help                                             Print Protractor help menu
  --version                                          Print Protractor version
  --browser, --capabilities.browserName              Browsername, e.g. chrome or firefox
  --seleniumAddress                                  A running seleium address to use
  --seleniumServerJar                                Location of the standalone selenium jar file
  --seleniumPort                                     Optional port for the selenium standalone ser
  --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 or mocha.

Please suggest what mistake I'm making in the config file or do I need to configure some more things.

Upvotes: 2

Views: 3751

Answers (1)

glepretre
glepretre

Reputation: 8167

You forgot a comma at the end of baseUrl: serverConfig.BASE_URL ;)

It should be:

baseUrl: serverConfig.BASE_URL,

Upvotes: 6

Related Questions