• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mochajs / mocha / 5224
91%
main: 94%

Build:
Build:
LAST BUILD BRANCH: v11.x
DEFAULT BRANCH: main
Ran 21 Dec 2018 07:18PM UTC
Jobs 1
Files 44
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
5224

Pull #3631

travis-ci

web-flow
execute test after "before each" hook asynchronously; closes #3009

This provides consistent, though not necessarily ideal, behavior when a
`Promise` is rejected within a "before" or "before each" hook and *not*
caught synchronously or within a `process.nextTick()` callback.

Previously, the `Promise` would be considered handled if it was rejected
in a "before each" hook and caught within the test, because the test
would be executed synchronously.  This is not the same case for a
"before" hook, which would consider the `Promise` unhandled.  Now, both
result in an unhandled exception warning from node.

An alternative implementation would be to execute tests within a
`process.nextTick()` callback (not sure what happens in a browser).
This would mean rejected `Promise`s in both cases would be considered
handled, because `process.nextTick()` would execute *before* the
microtask which then considers the `Promise` to be unhandled.

Mocha executes tests recursively, and needs to do so
asynchronously in order to avoid exceeding the maximum call stack.  As
per the Node.js documentation [here](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/),
this is *not* a valid use case of `process.nextTick()`.

Yet another alternative implementation which may avoid a decision
entirely would be to execute tests using a generator.  This could only
be *simulated* in an environment such as IE11, and thus would
potentially result in inconsistent or undefined behavior when running
the same tests in different browsers (that being said, generators are
probably a Good Idea for Mocha to consume in the long run).
Pull Request #3631: execute test after "before each" hook asynchronously; closes #3009

917 of 1115 branches covered (82.24%)

2 of 2 new or added lines in 1 file covered. (100.0%)

2354 of 2599 relevant lines covered (90.57%)

520.17 hits per line

Jobs
ID Job ID Ran Files Coverage
7 5224.7 21 Dec 2018 07:18PM UTC 0
90.57
Travis Job 5224.7
Source Files on build 5224
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #5224
  • Pull Request #3631
  • PR Base - master (#5218)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc