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

mochajs / mocha / 5224 / 7
91%
main: 94%

Build:
Build:
LAST BUILD BRANCH: v11.x
DEFAULT BRANCH: main
Ran 21 Dec 2018 07:18PM UTC
Files 44
Run time 2s
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

21 Dec 2018 07:01PM UTC coverage: 90.573% (+0.003%) from 90.57%
5224.7

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%)

2354 of 2599 relevant lines covered (90.57%)

520.17 hits per line

Source Files on job 5224.7
  • Tree
  • List 0
  • Changed 42
  • Source Changed 1
  • Coverage Changed 42
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 4792
  • Travis Job 5224.7
  • 5499b9d7 on github
  • Prev Job for on issue/3009 (#5218.7)
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