0.3.1 • Published 4 years ago
mocha-async-hooks-aware v0.3.1
mocha-async-hooks-aware
Extension for mocha javascript testing library to prevent async context leakage between tests.
Use
Add the dependency, e.g.:
yarn add -D mocha-async-hooks-awareAdd the following to your mocha config:
--require mocha-async-hooks-awareFor more info, see https://mochajs.org/#-require-module-r-module
Development
Setup
yarnRunning tests
yarn testDemonstrating why this lib is necessary
yarn test:no-protectionFurther reading
AsyncLocalStorage: https://nodejs.org/api/async_context.html#async_context_class_asynclocalstorage- why/when this lib is useful: https://github.com/mochajs/mocha/issues/4662