I'm trying to export protractor test results to xml files, for that I have installed jasmine-reporters using
npm install -g jasmine-reporters
.
Protractor version is Version 2.1.0
.
jasmine-reporters version 2.0.7
This is my protracotr config file:
exports.config = {
seleniumAddress: 'http://localhost:4455/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: [
'student_spec.js'
],
onPrepare: function() {
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter(null, true, true, '/test/e2e/JasmineReporter')
);
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 50000
}
};
When I run the protractor, I am getting this error
Error: Cannot find module 'jasmine-reporters'
Help me, where I'm doing wrong.
Make sure you have installed jasmine-reporters and the proper path of jasmine-reporters is provided. If it was installed properly then run the below command to see if you get the version of it -
npm list -g jasmine-reporters
If there was a problem installing it, use below command to install it which is compatible with Jasmine 2.x versions -
npm install --save-dev jasmine-reporters@^2.0.0
Update your conf.js file to include proper global scope variable jasmineReporters as mentioned in the package file -
framework: 'jasmine2',
onPrepare: function() {
var jasmineReporters = require('path_of_installed_jasmine-reporters-plugin');
//update proper path, in my case its ('/usr/local/lib/node_modules/jasmine-reporters')
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter(null, true, true, '/test/e2e/JasmineReporter')
);};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With