Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
mocha-eslint
Advanced tools
Run ESLint in your Mocha tests.
Inspired by mocha-jshint from Allan Ebdrup.
You can install into your node.js project as a development dependency with:
$ npm install --save-dev mocha-eslint
Mocha-eslint will install ESLint for itself, so you don't need to worry about adding it to your consuming module.
The same is not true for Mocha. You should already have Mocha installed in your consuming module.
After mocha-eslint is installed, you can use it by creating a test file for Mocha and requiring mocha-eslint like so:
var lint = require('mocha-eslint');
This will return a function with the signature:
lint(paths, options)
where paths
is an array of paths from your project's top level directory
and options
has a single property "formatter"
which can be assigned to the
name of any of the
ESLint formatters
("stylish" (the default), "compact", "checkstyle", "jslint-xml", "junit" and
"tap") or the full path to a JavaScript file containing a custom formatter. If
options
is not included, the default "stylish" formatter will be used.
So, a full test file to run in Mocha might look like:
var lint = require('mocha-eslint');
// Array of paths to lint
// Note: a seperate Mocha test will be run for each path
var paths = [
'bin',
'lib',
'tests',
];
// Specify style of output
var options = {};
options.formatter = 'compact';
// Get the party started
lint(paths, options);
This module does not make any decisions about which ESLint rules to run. Make sure your project has a .eslintrc file if you want something other than the default ESLint rules to execute.
v0.1.0
FAQs
run ESLint as mocha tests
The npm package mocha-eslint receives a total of 17,031 weekly downloads. As such, mocha-eslint popularity was classified as popular.
We found that mocha-eslint 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.