
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
jest-runner-mocha-next
Advanced tools
It is an experimental fork of jest-runner-mocha with some amazing features and fixes:
setupFilesAfterEnv
clearMocks
implementation (ex. for sinon)coverageProvider
v8
(node 10+ only)Install jest
(it needs Jest 21+) and jest-runner-mocha-next
npm install --save-dev jest jest-runner-mocha-next
In your package.json
{
"jest": {
"runner": "jest-runner-mocha-next"
}
}
Or in jest.config.js
module.exports = {
runner: 'jest-runner-mocha-next',
}
npx jest
This project uses cosmiconfig, so you can provide config via:
jest-runner-mocha
property in your package.json
jest-runner-mocha.config.js
JS file.jest-runner-mocharc
JSON fileIn package.json
{
"jest-runner-mocha": {
"cliOptions": {
// Options here
},
"coverageOptions": {
// Options here
}
}
}
or in jest-runner-mocha.config.js
module.exports = {
cliOptions: {
// Options here
},
"coverageOptions": {
// Options here
}
}
jest-runner-mocha maps some mocha CLI arguments to config options. For example --ui
is cliOptions.ui
option | example |
---|---|
ui | "ui": "tdd" |
timeout | "timeout": 10000 |
compiler | "compiler": "./path/to/babel-register" |
file | "file": ["./path/to/include.js", "/supports/multiple/files.js" ] |
jest-runner-mocha has some optional configuration for code coverage
option | example | description |
---|---|---|
useBabelRc | "useBabelRc": true | read .babelrc when instrumenting for code coverage (required if you transpile your code with babel). |
Coverage works outside of the box, simply npx jest -- --coverage
You can also use other Jest options like coveragePathIgnorePatterns and coverageReporters
Just make an export with a clearMocks function in your setupFilesAfterEnv
, like this:
'use strict';
const sinon = require('sinon');
const nock = require('nock');
module.exports = {
clearMocks: (suite) => {
sinon.sandbox.restore();
if(!nock.isDone()) {
console.log(`Warning: pending mocks in ${suite.file}: ${nock.pendingMocks()}`);
nock.cleanAll();
}
}
};
3.2.0
clearMocks
call;clearMocks
at the end of suite instead of the beginning;suite
to clearMocks
implementation;FAQs
An experimental Mocha runner for Jest
The npm package jest-runner-mocha-next receives a total of 0 weekly downloads. As such, jest-runner-mocha-next popularity was classified as not popular.
We found that jest-runner-mocha-next demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.