I'm currently working on automating an Angular 4 application. Whenever I execute "protractor config.js"
SCENARIO 1: If the format option in my config.ts file looks like this:
format: ['json:../reporting/results.json']
An error message is generated:
Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\test\config\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:.will-be-removed-after-cucumber-runs.tmp'
at Error (native)
Process finished with exit code 100
Empty test suite.
The issue seems to be related to the inability to access "resultsCapturer.js". The addition of the config.js file's relative path seems to be causing this problem, and I'm unsure how to resolve it.
SCENARIO 2: Changing the format option to:
format: ['pretty']
Results in an error:
Unhandled rejection Error: Cannot find module 'C:\MyWorkspace\protractor-cucumber-sample\test\config\pretty'
at Function.Module._resolveFilename (module.js:469:15)
I referred to this documentation but couldn't find a solution to the problem.
Details of my project are as follows:
Node version: v6.10.3
Protractor version: 5.1.2
config.ts:
import { Config } from 'protractor';
export let config: Config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ["../features/*.feature"],
framework: 'custom',
frameworkPath: require.resolve('node_modules/protractor-cucumber-framework'),
baseUrl: "http://localhost:4200/",
cucumberOpts: {
compiler: "ts:ts-node/register",
strict: true,
format: ['json:../reporting/results.json'],
require: ['../steps/*.js'],
tags: '@smoke'
}
}
package.json:
{
"name": "protractor-cucumber-sample",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"@types/jasmine": "^2.5.53",
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~2.6.3",
"express": "~4.15.2",
"jade": "~1.11.0",
"morgan": "~1.8.1",
"serve-favicon": "~2.4.2"
},
"devDependencies": {
"@types/chai": "^4.0.3",
"@types/cucumber": "^2.0.3",
"@types/mkdirp": "^0.5.0",
"chai": "^4.1.1",
"chai-as-promised": "^7.1.1",
"cucumber": "^3.0.0",
"cucumber-html-reporter": "^2.0.3",
"jasmine": "^2.7.0",
"jasminewd2": "^2.1.0",
"protractor-cucumber-framework": "^4.0.2",
"ts-node": "^3.3.0",
"typescript": "^2.4.2"
}
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,
"sourceMap": true,
"typeRoots": [
"./node_modules/@types/"
],
"lib": ["es2015"],
"strict": true
},
"compileOnSave": true,
"exclude": [
"node_modules/*",
"**/*-aot.ts"
]
}
If more information is needed to address this issue, please let me know.
Additionally, if this is not the appropriate forum for this question, or if you know of other forums where it can be posted, please advise.
Thank you in advance.