markuswaltre / protractor-e2e-coverage

A rough way to check coverage of e2e tests
7 stars 3 forks source link

Fail: ../node_modules/protractor-e2e-coverage/index.js Plugin Tests #6

Open djom202 opened 8 years ago

djom202 commented 8 years ago
 Fail:  ../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
        at [object Object].CoveragePlugin.setup (/Users/qrveyqa/qrvey/Code/node_modules/protractor-e2e-coverage/index.js:147:50)
        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.setup (/Users/qrveyqa/qrvey/Code/node_modules/protractor/built/plugins.js:235:25)
        at /Users/qrveyqa/qrvey/Code/node_modules/protractor/built/runner.js:268:28
        at _fulfilled (/Users/qrveyqa/qrvey/Code/node_modules/protractor/node_modules/q/q.js:834:54)
        at self.promiseDispatch.done (/Users/qrveyqa/qrvey/Code/node_modules/protractor/node_modules/q/q.js:863:30)
        at Promise.promise.promiseDispatch (/Users/qrveyqa/qrvey/Code/node_modules/protractor/node_modules/q/q.js:796:13)
        at /Users/qrveyqa/qrvey/Code/node_modules/protractor/node_modules/q/q.js:604:44

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)

djom202 commented 8 years ago

My protractor config file

plugins: [{ path: '../node_modules/protractor-e2e-coverage/index.js' // outdir: 'reports/e2e/' }],

ludmilanesvitiy commented 8 years ago

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)

dmc2015 commented 8 years ago

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

ayashpatrov commented 8 years ago

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.

gtvforever commented 7 years ago

Got the same issue, even i modified the configuration per ayashpatrov 's suggestion.

filipedumont commented 7 years ago

Have anyone figured out this issue so far?

djom202 commented 7 years ago

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.

djom202 commented 7 years ago

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;
    });
};
ConnerAiken commented 7 years ago

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();
tkssharma commented 5 years ago

is this working @ConnerAiken ??

ConnerAiken commented 5 years ago

@tkssharma It's been a while since I used this, give it a try!

nortonmobileapp commented 5 years ago

Issue still not fixed i am getting the same error.