Socket
Socket
Sign inDemoInstall

eslint-plugin-mocha

Package Overview
Dependencies
Maintainers
3
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-mocha - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 6.1.0 (August 22, 2019)
### Enhancements
* Add custom message for valid-suite-description ([#207](https://github.com/lo1tuma/eslint-plugin-mocha/pull/207))
* Add custom message for valid-test-description rule ([#206](https://github.com/lo1tuma/eslint-plugin-mocha/pull/206))
## 6.0.0 (July 17, 2019)

@@ -2,0 +9,0 @@

23

lib/rules/valid-suite-description.js

@@ -11,6 +11,25 @@ 'use strict';

module.exports = function (context) {
function inlineOptions(context) {
const pattern = new RegExp(context.options[0]);
const suiteNames = context.options[1] ? context.options[1] : defaultSuiteNames;
const message = context.options[2];
return { pattern, suiteNames, message };
}
function objectOptions(options) {
const pattern = new RegExp(options.pattern);
const suiteNames = options.suiteNames ? options.suiteNames : defaultSuiteNames;
const message = options.message;
return { pattern, suiteNames, message };
}
module.exports = function (context) {
const options = context.options[0];
const { pattern, suiteNames, message } = typeof options === 'object' && !(options instanceof RegExp) ?
objectOptions(options) :
inlineOptions(context);
function isSuite(node) {

@@ -44,3 +63,3 @@ return node.callee && node.callee.name && suiteNames.indexOf(node.callee.name) > -1;

if (!hasValidOrNoSuiteDescription(node)) {
context.report(node, `Invalid "${ callee.name }()" description found.`);
context.report(node, message || `Invalid "${ callee.name }()" description found.`);
}

@@ -47,0 +66,0 @@ }

@@ -12,6 +12,25 @@ 'use strict';

module.exports = function (context) {
function inlineOptions(context) {
const pattern = context.options[0] ? new RegExp(context.options[0]) : /^should/;
const testNames = context.options[1] ? context.options[1] : defaultTestNames;
const message = context.options[2];
return { pattern, testNames, message };
}
function objectOptions(options) {
const pattern = options.pattern ? new RegExp(options.pattern) : /^should/;
const testNames = options.testNames ? options.testNames : defaultTestNames;
const message = options.message;
return { pattern, testNames, message };
}
module.exports = function (context) {
const options = context.options[0];
const { pattern, testNames, message } = typeof options === 'object' && !(options instanceof RegExp) ?
objectOptions(options) :
inlineOptions(context);
function isTest(node) {

@@ -45,3 +64,3 @@ return node.callee && node.callee.name && testNames.indexOf(node.callee.name) > -1;

if (!hasValidOrNoTestDescription(node)) {
context.report(node, `Invalid "${ callee.name }()" description found.`);
context.report(node, message || `Invalid "${ callee.name }()" description found.`);
}

@@ -48,0 +67,0 @@ }

2

package.json
{
"name": "eslint-plugin-mocha",
"version": "6.0.0",
"version": "6.1.0",
"description": "Eslint rules for mocha.",

@@ -5,0 +5,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc