Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mochawesome reporter fails with mocha 4 #741

Closed
Kporal opened this issue Oct 9, 2017 · 3 comments
Closed

Mochawesome reporter fails with mocha 4 #741

Kporal opened this issue Oct 9, 2017 · 3 comments
Assignees

Comments

@Kporal
Copy link
Contributor

Kporal commented Oct 9, 2017

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"
}
@DavertMik
Copy link
Contributor

Could this be that in this config you have 2 verisons of Mocha installed?
if so that explains everything. We need to update dependency to support latest mocha

@Kporal
Copy link
Contributor Author

Kporal commented Oct 11, 2017

Yes you're right. I think codeceptjs dependency needs to be updated to avoid that issue.

@dreuxl
Copy link

dreuxl commented Nov 8, 2017

Is that still an issue after having only one version of Mocha in your project, ie Mocha 4.x ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants