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

[wct-mocha] Doesn't work with the latest major version of mocha (^6.0.0) #3394

Closed
svanherk opened this issue Apr 4, 2019 · 2 comments · Fixed by #3424
Closed

[wct-mocha] Doesn't work with the latest major version of mocha (^6.0.0) #3394

svanherk opened this issue Apr 4, 2019 · 2 comments · Fixed by #3424

Comments

@svanherk
Copy link

svanherk commented Apr 4, 2019

Description

When using wct-mocha with mocha version ^6.0.0, the tests start to run but then the following error is thrown at https://github.com/mochajs/mocha/blob/master/lib/reporters/html.js#L236:

TypeError: Cannot read property 'tests' of undefined

I believe this is happening because of the following breaking change in version 6:

#3458: Instantiating a Base-extending reporter without a Runner parameter will throw an exception

As part of this, statistics were refactored out into their own helper: https://github.com/mochajs/mocha/pull/3458/files

If I pull lib/stats-collector.js into wct-mocha, and then add createStatsCollector(runner); before these two lines, the tests appear to start working again:
https://github.com/Polymer/tools/blob/master/packages/wct-mocha/src/reporters/console.ts#L84
https://github.com/Polymer/tools/blob/master/packages/wct-mocha/src/reporters/title.ts#L24

Versions

  • wct-mocha ^1.0.0
  • mocha ^6.0.0 (mocha ^5.0.0 is fine)
@nicojs
Copy link

nicojs commented Apr 9, 2019

Yes, I can confirm that this is a bug. I was looking for ~3 hours, since I didn't know web-component-tester needed me to "bring my own mocha" and had mocha as a dependency to test something else.

Thanks @svanherk for reporting this issue.

nicojs added a commit to stryker-mutator/stryker-js that referenced this issue Apr 10, 2019
nicojs pushed a commit to stryker-mutator/stryker-js that referenced this issue Apr 10, 2019
* build(deps-dev): update mocha requirement from ^5.2.0 to ^6.1.2

Updates the requirements on [mocha](https://github.com/mochajs/mocha) to permit the latest version.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](mochajs/mocha@v5.2.0...v6.1.2)

Signed-off-by: dependabot[bot] <[email protected]>
* chore: remove unused argument for mocha 6
* test(wct): keep mocha version on 5 for wct runner
    See Polymer/tools#3394
* deps(wct): bring our own sinon
* chore(bootstrap): remove dependency on `mz`
@simondel
Copy link

@rictic @usergenic @azakus @justinfagnani @aomarks @FredKSchott Would it be possible to get an update on this?

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