Open djom202 opened 8 years ago
My protractor config file
plugins: [{ path: '../node_modules/protractor-e2e-coverage/index.js' // outdir: 'reports/e2e/' }],
The same problem:
Fail: /home/vs/node_modules/protractor-e2e-coverage/index.js Plugin Tests
Failure during setup: Cannot read property 'outdir' of undefined
TypeError: Cannot read property 'outdir' of undefined
Fail: /home/vs/node_modules/protractor-e2e-coverage/index.js Runtime Failure during postResults: path must be a string or Buffer TypeError: path must be a string or Buffer at TypeError (native)
I am experiencing this issue also.
I/plugins - Fail: ./../../../node_modules/protractor-e2e-coverage/index.js Plugin Tests [07:14:50] E/plugins - Failure during setup: Cannot read property 'outdir' of undefined [07:14:50] E/plugins - TypeError: Cannot read property 'outdir' of undefined
I/plugins - Fail: ./../../../node_modules/protractor-e2e-coverage/index.js Runtime [07:14:51] E/plugins - Failure during postResults: path must be a string [07:14:51] E/plugins - TypeError: path must be a string
I got same problem. TypeError: Cannot read property 'outdir' of undefined. TypeError: path must be a string.
And I changed my path: { path: 'node_modules/protractor-e2e-coverage', outdir: 'test/coverage' } It was the only way to work.
Got the same issue, even i modified the configuration per ayashpatrov 's suggestion.
Have anyone figured out this issue so far?
The problem looks like be that the plugin never received the outdir param. If you use the path parameter works or if you use package with the plugin name too works, but never recieved the outdir parameter.
Maybe yo can fix with this code:
CoveragePlugin.prototype.setup` = function(config) {
var self = this;
self.outdir = (config.outdir) ? config.outdir : path.resolve(process.cwd(), 'reports/coverage');
if (config.elements) {
self.webelements.elements = config.elements;
}
browser.manage().logs().getAvailableLogTypes().then(function(res) {
self.browserLogAvailable = res.indexOf('browser') > -1;
});
};
Here is a good solution until Markus has time.
Specify in your protractor.conf.js a custom script.
plugins: [
{
path: 'scripts/protractor-e2e-coverage-custom.js'
}
];
In the custom script, set the default value.
const coverage = require('protractor-e2e-coverage');
const path = require('path');
coverage.outdir = path.resolve(process.cwd(), 'test/e2e-stats/report');
var coveragePlugin = new coverage.CoveragePlugin();
is this working @ConnerAiken ??
@tkssharma It's been a while since I used this, give it a try!
Issue still not fixed i am getting the same error.
json file location: Code/features/reports/report-6-3-2016-16h-34m.json Fail: ../node_modules/protractor-e2e-coverage/index.js Runtime Failure during postResults: path must be a string TypeError: path must be a string at TypeError (native) at Object.fs.mkdirSync (fs.js:794:18) at [object Object].CoveragePlugin.outputResults (/Users/qrveyqa/qrvey/Code/node_modules/protractor-e2e-coverage/index.js:237:8) at [object Object].CoveragePlugin.postResults (/Users/qrveyqa/qrvey/Code/node_modules/protractor-e2e-coverage/index.js:259:8) at Plugins.safeCallPluginFun (/Users/qrveyqa/qrvey/Code/node_modules/protractor/built/plugins.js:203:45) at /Users/qrveyqa/qrvey/Code/node_modules/protractor/built/plugins.js:237:36 at Array.forEach (native) at Plugins.postResults (/Users/qrveyqa/qrvey/Code/node_modules/protractor/built/plugins.js:235:25) at /Users/qrveyqa/qrvey/Code/node_modules/protractor/built/runner.js:344:28 at _fulfilled (/Users/qrveyqa/qrvey/Code/node_modules/protractor/node_modules/q/q.js:834:54)