Ошибка в файле index.d.ts в папке node_modules / @ types / chai - PullRequest
1 голос
/ 19 октября 2019

Получение приведенной ниже ошибки при запуске команды «npm run am: remote: dev». Ошибка, отображаемая в строках с 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

Попытался удалить папку узловых модулей и снова установить npm. Попытался удалить все приложения и снова заново полностью их переустановить. Все еще ошибка была все еще там. Это скрипт автоматизации, написанный на огурце, транспортир с использованием машинописи.

PFB файл удаленной конфигурации, имеющий конфигурацию запуска:

// 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,
  },
};

При запуске команды открывается экземпляр стека обозревателя, который записывает приложение.


PFB файл package.json для справки.

{
  "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"
  }
}

1 Ответ

0 голосов
/ 11 ноября 2019

Я встретил ту же самую проблему и исправил ее, обновив typescript с 2.3.4 до 3.7.2.

Фиксация: https://github.com/Jeff-Tian/ali-mns/commit/28c07d27f568bea56143bec4ab3c96ac130bbcc5#diff-b9cfc7f2cdf78a7f4b91a753d10865a2

История сборки для этого коммита: https://travis -ci.com / Jeff-Тян / Ali-MNS / строит / 135875304

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...