Skip to content

Commit

Permalink
MochaAdapter: Fix for Mocha 8.0+ use of STATE_PENDING
Browse files Browse the repository at this point in the history
Re-ran `npm run test-versions` and confirmed compatibility with 8.0
and all versions since.

Fixes #116.
  • Loading branch information
Krinkle committed Feb 14, 2021
1 parent 05fc407 commit 4d81c00
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 57 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ JsReporters.TapReporter.init(runner);

| Testing framework | Supported | Last checked | Unresolved
|--|--|--|--
| QUnit | 1.20+ | ✅ `qunit@2.11.1` (Sep 2020) | –
| Jasmine | 2.1+ | ✅ `jasmine@3.6.1` (Jul 2020) | –
| Mocha | 1.18+ | ✅ `mocha@7.2.0` (May 2020) | ⚠️ `>= mocha@8.0.0` ([issue #116](https://github.com/js-reporters/js-reporters/issues/116))
| QUnit | 1.20+ | ✅ `qunit@2.14.0` (Jan 2021) | –
| Jasmine | 2.1+ | ✅ `jasmine@3.6.4` (Jan 2021) | –
| Mocha | 1.18+ | ✅ `mocha@8.3.0` (Feb 2021) |

See also [past issues](test/versions/failing-versions.js).

Expand Down
4 changes: 3 additions & 1 deletion lib/adapters/MochaAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ module.exports = class MochaAdapter extends EventEmitter {
message: error.message || error.toString(),
stack: error.stack
}));
const status = (mochaTest.state === undefined) ? 'skipped' : mochaTest.state;
// Mocha 8.0 introduced STATE_PENDING
// https://github.com/js-reporters/js-reporters/issues/116
const status = (mochaTest.state === undefined || mochaTest.state === 'pending') ? 'skipped' : mochaTest.state;
const runtime = (mochaTest.duration === undefined) ? null : mochaTest.duration;

return {
Expand Down
Loading

0 comments on commit 4d81c00

Please sign in to comment.