Closed
Description
What are you trying to achieve?
When using mochawesome as reporter, codecepts fails when I've errors in my tests. The report is not generated.
npm install && npm test
What do you get instead?
/test/node_modules/mocha/lib/reporters/base.js:227
test.titlePath().forEach(function (str, index) {
^
TypeError: test.titlePath is not a function
at /test/node_modules/mocha/lib/reporters/base.js:227:10
at Array.forEach (<anonymous>)
at Function.exports.list (/test/node_modules/mocha/lib/reporters/base.js:167:12)
at Spec.Base.epilogue (/test/node_modules/mocha/lib/reporters/base.js:344:10)
at emitNone (events.js:110:20)
at Runner.emit (events.js:207:7)
at /test/node_modules/codeceptjs-webdriverio/node_modules/mocha/lib/runner.js:812:12
at done (/test/node_modules/codeceptjs-webdriverio/node_modules/mocha/lib/runner.js:649:7)
at Runner.next [as nextSuite] (/test/node_modules/codeceptjs-webdriverio/node_modules/mocha/lib/runner.js:616:16)
at Runner.uncaught (/test/node_modules/codeceptjs-webdriverio/node_modules/mocha/lib/runner.js:737:17)
It seems to be caused by this change from the 4.0.0 release of Mocha.
My test file
// fail_test.js
const assert = require('assert');
Feature('Fail');
Scenario('fails', (I) => {
assert.equal((1 + 1), 3);
});
My package.json
{
"name": "test",
"version": "1.0.0",
"scripts": {
"postinstall": "selenium-standalone install",
"pretest": "selenium-standalone start 2> /dev/null &",
"test": "codeceptjs run fail_test.js --reporter mochawesome"
},
"engine": "node >= 8",
"devDependencies": {
"codeceptjs-webdriverio": "^1.1.0",
"mocha": "^4.0.0",
"mochawesome": "^2.3.1",
"selenium-standalone": "^6.9.0"
}
}
Details
- codeceptjs-webdriverio: 1.1.0
- NodeJS Version: 8.5.0
- Operating System: Mac OS X
- Configuration file:
{
"tests": "./*_test.js",
"timeout": 10000,
"output": "./output",
"helpers": {
"WebDriverIO": {
"url": "http://localhost",
"browser": "chrome"
}
},
"include": {},
"bootstrap": false,
"mocha": {
"reporterOptions": {
"reportDir": "output"
}
},
"name": "mocha"
}