У меня ошибка в import { browser } from "protractor";
и выбрасывается SyntaxError: Невозможно использовать оператор импорта вне модуля в командной строке.
Я использую машинопись, мокко и транспортир.
Вот mochaOpts
:
mochaOpts: {
bail: false,
ui: 'bdd',
reporter: 'spec',
compiler: 'ts:ts-node/register'
},
Вот зависимости в пакете. json:
"dependencies": {
"@babel/cli": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"@babel/register": "^7.7.4",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.6",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"graphviz": "0.0.9",
"lodash": "^4.17.15",
"minimist": "^1.2.0",
"mocha": "^6.2.2",
"npm-failsafe": "^0.4.1",
"protractor": "^5.4.2",
"rimraf": "^2.7.1",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"typescript": "^3.8.2",
"typescript-logging": "^0.6.4",
"webdriver-manager": "^12.1.7",
"yargs": "^13.3.0"
}
Вот tsconfig. json:
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"paths": { "*": ["types/*"] },
"outDir": "./dist/out-tsc",
"mapRoot": "./dist/out-tsc/",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"typeRoots": [
"node_modules/@types"
]
}
}