Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
}
});
}
var Mocha = require('mocha');
var mocha = new Mocha();
mocha.ui('bdd').reporter(isCi ? 'tap' : 'html');
var query = Mocha.utils.parseQuery(window.location.search || '');
if (query.grep) mocha.grep(query.grep);
if (query.invert) mocha.invert();
// Read all test files.
var walker = require('walkdir').walk(require('path').dirname(__dirname), {
no_recurse: true
});
walker.on('file', function(file) {
if (/-spec.js/.test(file))
mocha.addFile(file);
});
walker.on('end', function() {
var runner = mocha.run(function() {
Mocha.utils.highlightTags('code');
if (isCi) {
ipc.send('process.exit', runner.failures);
}
});
});
import {walk} from 'walkdir'
// Read all test files.
let walker = walk(__dirname, { no_recurse: true })
walker.on('file', function (file) {
let matches = file.match(/([^\/^\\]+-spec).js$/)
if (!matches) return
let modpath = `./${matches[1]}`
require(modpath)
})
function startScan(self) {
if (self.library != null) return;
self.library = {};
console.log('starting library scan');
var start_time = new Date();
var pend = new Pend();
pend.max = 20;
var musicPath = maybeAddTrailingSlash(self.musicLibPath);
var walker = walk.walk(musicPath);
walker.on('file', function(filename, stat) {
if (ignoreFile(filename)) return;
pend.go(function(cb) {
var stream = fs.createReadStream(filename);
var parser = new MusicMetadataParser(stream);
var localFile = path.relative(self.musicLibPath, filename);
var metadata = null;
parser.on('mime', function(mime) {
// this event is fired when we know that it is an audio file
// we will add it to the library whether or not it has metadata.
metadata = defaultMetaData;
});
parser.on('metadata', function(md) {
metadata = md;
});
parser.on('done', function() {
mochaOptions.reporterOptions = {
reporterEnabled: process.env.MOCHA_MULTI_REPORTERS
}
}
const mocha = new Mocha(mochaOptions)
if (!process.env.MOCHA_REPORTER) {
mocha.ui('bdd').reporter('tap')
}
mocha.timeout(30000)
if (argv.grep) mocha.grep(argv.grep)
if (argv.invert) mocha.invert()
// Read all test files.
const walker = require('walkdir').walk(__dirname, {
no_recurse: true
})
// This allows you to run specific modules only:
// npm run test -match=menu
const moduleMatch = process.env.npm_config_match
? new RegExp(process.env.npm_config_match, 'g')
: null
const testFiles = []
walker.on('file', (file) => {
if (/-spec\.[tj]s$/.test(file) &&
(!moduleMatch || moduleMatch.test(file))) {
testFiles.push(file)
}
})
}
const mocha = new Mocha(mochaOptions)
if (!process.env.MOCHA_REPORTER) {
mocha.ui('bdd').reporter('tap')
}
mocha.timeout(30000)
const query = Mocha.utils.parseQuery(window.location.search || '')
if (query.grep) mocha.grep(query.grep)
if (query.invert) mocha.invert()
const files = query.files ? query.files.split(',') : undefined
// Read all test files.
const walker = require('walkdir').walk(path.dirname(__dirname), {
no_recurse: true
})
// This allows you to run specific modules only:
// npm run test -match=menu
const moduleMatch = process.env.npm_config_match
? new RegExp(process.env.npm_config_match, 'g')
: null
const testFiles = []
walker.on('file', (file) => {
if (/-spec\.js$/.test(file) && (!moduleMatch || moduleMatch.test(file))) {
testFiles.push(file)
}
})