1
0
Fork 0

Export foxx/mocha.findTests

This commit is contained in:
Alan Plum 2016-06-17 16:16:53 +02:00
parent 84a05ebc38
commit a56aae69d4
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
1 changed files with 7 additions and 7 deletions

View File

@ -29,17 +29,17 @@ const mocha = require('@arangodb/mocha');
const isNotPattern = (pattern) => pattern.indexOf('*') === -1;
exports.run = function runFoxxTests(app, reporterName) {
const run = (file, context) => app.run(file, {context: context});
return mocha.run(run, findTestFiles(app), reporterName);
exports.run = function runFoxxTests(service, reporterName) {
const run = (file, context) => service.run(file, {context: context});
return mocha.run(run, exports.findTests(service), reporterName);
};
function findTestFiles(app) {
const patterns = app.manifest.tests || [];
exports.findTests = function findTestFiles(service) {
const patterns = service.manifest.tests || [];
if (patterns.every(isNotPattern)) {
return patterns.slice();
}
const basePath = fs.join(app.root, app.path);
const basePath = fs.join(service.root, service.path);
const paths = fs.listTree(basePath);
const matchers = patterns.map((pattern) => {
if (pattern.charAt(0) === '/') {
@ -54,4 +54,4 @@ function findTestFiles(app) {
isWindows ? path.replace(/\\/g, '/') : path
)) && fs.isFile(fs.join(basePath, path))
);
}
};