3

Getting the below error on running "npm run am:remote:dev" command. Error showing in lines from 912 - 1916.

node_modules/@types/chai/index.d.ts(1879,43): error TS1005: ',' expected.
node_modules/@types/chai/index.d.ts(1879,56): error TS1005: ',' expected.
node_modules/@types/chai/index.d.ts(1879,71): error TS1005: ',' expected.
node_modules/@types/chai/index.d.ts(1879,86): error TS1109: Expression expected

Tried delete node modules folder and installed npm again. Tried uninstall all the applications and again re-installed them completely again. Still the error was still there. This is an automation script written in cucumber, protractor using typescript.

PFB the remote-config file which is having the run config:

// tslint:disable:max-line-length
// tslint:disable:no-console
import { browser, Config } from 'protractor';
import capabilitiesConfig from '../capabilities';
const jsonReports = process.cwd() + '/reports/json';
const browserStack = require('browserstack-local');

export const config: Config = {

  multiCapabilities: [
    capabilitiesConfig['chrome-windows10'],
    capabilitiesConfig['chrome-windows7'],
    capabilitiesConfig['firefox-high-sierra'],
    capabilitiesConfig['firefox-windows10'],
    capabilitiesConfig['firefox-windows7'],
    capabilitiesConfig['google-pixel3'],
    capabilitiesConfig['iphone8-plus'],
    capabilitiesConfig.iphonex,
    capabilitiesConfig['samsung-galaxy-s7'],
    capabilitiesConfig['samsung-galaxy-s8'],
  ],
  allScriptsTimeout: 60000,
  // to connect directly to the browser Drivers. Only available for Firefox and Chrome. Use if no browserstack credentials
  directConnect: false,
  // Browserstack credentials
  browserstackUser: 'dbxadminuser1',
  browserstackKey: '6s257AhmKXh6f4q9AHpi',

  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),

  specs: [
    // Login
    // makes sure login runs first
    '../../../tests/am/features/login/login.feature', 

    // Profile
    '../../../tests/am/features/profile/profileUI.feature',

    // Logout
    '../../../tests/am/features/logout/logout.feature'
  ],

  // runs before preparing the testing environment. This particular function connects to the Browserstack servers
  beforeLaunch: () => {
      console.log('Connecting local');
      return new Promise((resolve: any, reject: any) => {
          exports.bs_local = new browserStack.Local();
          exports.bs_local.start({ key: exports.config.browserstackKey }, (error: any) => {
              if (error) { return reject(error); }
              console.log('Connected. Now testing...');

              resolve();
          });
      });
  },

  // runs after all tests have finished running. This stops the Browserstack server
  afterLaunch: () => {
      return new Promise((resolve: any, reject: any) => {
          exports.bs_local.stop(resolve);
      });
  },

  onPrepare: () => {
        browser.waitForAngularEnabled(false);
        // Reporter.createDirectory(jsonReports);
        browser.getProcessedConfig().then((processedConfig: any) => {
            browser.params.login = {
                username: processedConfig.capabilities.username,
                password: process.env.BS_PASSWORD,
            };
        });
  },
  plugins: [{
        package: 'protractor-multiple-cucumber-html-reporter-plugin',
        options: {
            automaticallyGenerateReport: true,
        },
    }],
  params: {
      env: 'local',
      login: {
        username: '',
        password: '',
      },
      application: 'am',
  },

  cucumberOpts: {
    compiler: 'ts:ts-node/register',
    format: 'json:.tmp/am/results.json',
    require: [
      '../../tests/shared/features/*/*.step.js',
      '../../tests/am/features/*/*.step.js',
    ],
    strict: true,
  },
};

Upon running the command, an instance of browserstack will get opened which records the application.


PFB the package.json file for reference.

{
  "name": "rockwell-automation-tests",
  "version": "1.0.0",
  "license": "MIT",
  "description": "",
  "author": "",
  "repository": "https://github.com/SolsticeConsulting/rockwell-testing",
  "scripts": {
    "tag": "tsc && protractor typeScript/config/my/local.config.js --cucumberOpts.tags=$TAG --params.env=$ROK_ENV",
    "remote-tag": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags=$TAG --params.env=$ROK_ENV",
    "build": "tsc",
    "clean": "rimraf typeScript/",
    "clean-build": "npm run clean && npm run build",
    "am:debug": "tsc && node --inspect-brk node_modules/protractor/bin/protractor typeScript/config/am/local.config.js",
    "am:remote:dev": "tsc && protractor typeScript/config/am/remote.config.js --params.env=dev",
    "am:remote:uat": "tsc && protractor typeScript/config/am/remote.config.js --params.env=uat",
    "am:remote:devqa": "tsc && protractor typeScript/config/am/remote.config.js --params.env=devqa",
    "am:remote:uatqa": "tsc && protractor typeScript/config/am/remote.config.js --params.env=uatqa",
    "am:remote:raqa": "tsc && protractor typeScript/config/am/remote.config.js --params.env=raqa",
    "my:debug": "tsc && node --inspect-brk node_modules/protractor/bin/protractor typeScript/config/my/local.config.js",
    "my:local": "tsc && protractor typeScript/config/my/local.config.js",
    "am:local": "tsc && protractor typeScript/config/am/local.config.js",
    "my:remote:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=dev",
    "my:remote:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=devqa",
    "my:remote:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=uat",
    "my:remote:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=uatqa",
    "my:remote:raqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=raqa",
    "my:remote:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Smoke' --params.env=prod",
    "my:remote:bom:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Bom' --params.env=dev",
    "my:remote:bom:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Bom' --params.env=qa",
    "my:remote:bom:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Bom' --params.env=uat",
    "my:remote:bomorders:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@BOMOrders' --params.env=dev",
    "my:remote:bomorders:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@BOMOrders' --params.env=qa",
    "my:remote:bomorders:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@BOMOrders' --params.env=uat",
    "my:remote:bomorders:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@BOMOrders' --params.env=uatqa",
    "my:remote:repairs:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=dev",
    "my:remote:repairs:test": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=test",
    "my:remote:repairs:testqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=testqa",
    "my:remote:repairs:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=uat",
    "my:remote:repairs:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=uatqa",
    "my:remote:repairs:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Repairs' --params.env=prod",
    "my:remote:equipment:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@MyEquipment' --params.env=dev",
    "my:remote:equipment:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@MyEquipment' --params.env=devqa",
    "my:remote:powerbi:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@PowerBI' --params.env=dev",
    "my:remote:powerbi:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@PowerBI' --params.env=devqa",
    "my:remote:powerbi:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@PowerBI' --params.env=uat",
    "my:remote:powerbi:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@PowerBI' --params.env=uatqa",
    "my:remote:powerbi:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@PowerBI' --params.env=prod",
    "my:remote:equipment:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@MyEquipment' --params.env=prod",
    "my:remote:services:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@Services' --params.env=dev",
    "my:remote:csm:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@CSM' --params.env=devqa",
    "my:remote:csm:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@CSM' --params.env=dev",
    "my:remote:csm:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@CSM' --params.env=uat",
    "my:remote:csm:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@CSM' --params.env=uatqa",
    "my:remote:csm:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@CSM' --params.env=prod",
    "my:remote:product-availability:devqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@ProductAvailability' --params.env=devqa",
    "my:remote:product-availability:dev": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@ProductAvailability' --params.env=dev",
    "my:remote:product-availability:uat": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@ProductAvailability' --params.env=uat",
    "my:remote:product-availability:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@ProductAvailability' --params.env=uatqa",
    "my:remote:product-availability:prod": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@ProductAvailability' --params.env=prod",
    "my:remote:security:uatqa": "tsc && protractor typeScript/config/my/remote.config.js --cucumberOpts.tags='@BOMSecurity' --params.env=uatqa",
    "webdriver-update": "webdriver-manager update",
    "webdriver-start": "webdriver-manager start"
  },
  "devDependencies": {
    "@types/chai": "^4.1.3",
    "@types/chai-as-promised": "^7.1.0",
    "@types/cucumber": "^4.0.4",
    "@types/node": "8.9.4",
    "@types/selenium-webdriver": "3.0.8",
    "browserstack-local": "^1.3.7",
    "browserstack-webdriver": "2.41.1",
    "chai": "4.1.2",
    "chai-as-promised": "7.1.1",
    "cucumber": "4.0.0",
    "cucumber-html-reporter": "^4.0.4",
    "mkdirp": "^0.5.1",
    "protractor": "^5.4.1",
    "protractor-cucumber-framework": "5.0.0",
    "protractor-multiple-cucumber-html-reporter-plugin": "1.7.0",
    "rimraf": "^2.6.2",
    "ts-node": "5.0.0",
    "typescript": "2.7.2",
    "webdriver-manager": "12.1.7",
    "tslint": "^5.18.0"
  },
  "dependencies": {
    "@types/protractor": "^4.0.0",
    "@types/uuid": "^3.4.4"
  }
}
4
  • Hi, can you paste package.json? Commented Oct 19, 2019 at 19:45
  • Hi Frecia, have added the package.json file. Commented Oct 20, 2019 at 18:02
  • Thank you, what tsc version are you running? Commented Oct 20, 2019 at 19:21
  • TSC version 3.6.4, Node version 10.16.3, non version 6.9.0, VSCode 1.39.2 Commented Oct 21, 2019 at 8:22

2 Answers 2

2

I met the same exact issue and fixed it by upgrading typescript from 2.3.4 to 3.7.2.

Commit: https://github.com/Jeff-Tian/ali-mns/commit/28c07d27f568bea56143bec4ab3c96ac130bbcc5#diff-b9cfc7f2cdf78a7f4b91a753d10865a2

Build History for that commit: https://travis-ci.com/Jeff-Tian/ali-mns/builds/135875304

Sign up to request clarification or add additional context in comments.

1 Comment

Jeff, thanks for the solution. I was able to solve the issue not by the same steps. My project had some error connecting with git, that was the problem the error was coming, I was able to resolve by re-establishing the git.
1

I had a similar issue:

node_modules/@types/sinon-chai/node_modules/@types/sinon/index.d.ts(30,57): error TS1005: ',' expected.
node_modules/@types/sinon-chai/node_modules/@types/sinon/index.d.ts(30,66): error TS1011: An element access expression should take an argument.
node_modules/@types/sinon-chai/node_modules/@types/sinon/index.d.ts(35,20): error TS1005: ',' expected.
node_modules/@types/sinon-chai/node_modules/@types/sinon/index.d.ts(50,9): error TS1005: ',' expected.

Changing the typescript version in package.json seemed to fix it. From :

"typescript": "3.2.4",

to:

 "typescript": "3.7.2",

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.