Skip to content

Commit

Permalink
Support Mocha and ESlint v6
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Grandvuinet committed Nov 7, 2019
1 parent ea0211b commit e651a9a
Show file tree
Hide file tree
Showing 3 changed files with 883 additions and 295 deletions.
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ var globAll = require('glob-all');
var replaceAll = require("replaceall");
var cli = new CLIEngine({});

var mochaInterface;

function test(p, opts) {
opts = opts || {};
it('should have no errors in ' + p, function () {
mochaInterface.it('should have no errors in ' + p, function () {
var format, warn;

if (opts.timeout) {
Expand Down Expand Up @@ -50,10 +52,21 @@ function test(p, opts) {
}

module.exports = function (patterns, options) {
mochaInterface = getMochaInterface();
var contextName = (options && options.contextName) || 'eslint';
describe(contextName, function () {
mochaInterface.describe(contextName, function () {
globAll.sync(patterns).forEach(function (file) {
test(file, options);
});
});
};

function getMochaInterface () {
if (global.describe) {
return { describe: global.describe, it: global.it };
}
if (global.suite) {
return { describe: global.suite, it: global.test };
}
throw new Error('no mocha interface was found on the global scope');
}
Loading

0 comments on commit e651a9a

Please sign in to comment.