mocha-ur2ue

Mocha root hook plugin to convert unhandled rejection events to unhandled exceptions so that they will cause test failures.

Usage no npm install needed!

<script type="module">
  import mochaUr2ue from 'https://cdn.skypack.dev/mocha-ur2ue';
</script>

README

mocha-ur2ue

Build Status: Linux Build Status: Windows Dependency Status Supported Node Version Version on NPM

A Mocha root hook plugin to convert unhandledrejection events to unhandled exceptions so that they will cause test failures. This works around a long-standing issue (mochajs/mocha#1926 and mochajs/mocha#2640) that unhandled rejections do not cause test failure in Mocha.

Introductory Example

npm install --save-dev mocha mocha-ur2ue
mocha --require mocha-ur2ue --recursive tests

Installation

This package can be installed using npm, either globally or locally, by running:

npm install mocha-ur2ue

Contributing

Contributions are appreciated. Contributors agree to abide by the Contributor Covenant Code of Conduct. If this is your first time contributing to a Free and Open Source Software project, consider reading How to Contribute to Open Source in the Open Source Guides.

If the desired change is large, complex, backwards-incompatible, can have significantly differing implementations, or may not be in scope for this project, opening an issue before writing the code can avoid frustration and save a lot of time and effort.

License

This project is available under the terms of the MIT License. See the summary at TLDRLegal.