Try to restore yarn mocha and move browser tests to /browser/

This commit is contained in:
Alex Dima
2021-11-23 16:07:03 +01:00
parent 2c6630a5ce
commit 689467c841
23 changed files with 29 additions and 24 deletions

View File

@@ -10,9 +10,8 @@ const assert = require('assert');
const path = require('path');
const glob = require('glob');
const jsdom = require('jsdom-no-contextify');
const TEST_GLOB = '**/test/**/*.test.js';
const minimatch = require('minimatch');
const coverage = require('../coverage');
const optimist = require('optimist')
.usage('Run the Code tests. All mocha options apply.')
.describe('build', 'Run from out-build').boolean('build')
@@ -22,6 +21,9 @@ const optimist = require('optimist')
.alias('h', 'help').boolean('h')
.describe('h', 'Show help');
const TEST_GLOB = '**/test/**/*.test.js';
const excludeGlob = '**/{browser,electron-sandbox,electron-browser,electron-main,editor/contrib}/**/*.test.js';
const argv = optimist.argv;
if (argv.help) {
@@ -112,10 +114,13 @@ function main() {
} else {
loadFunc = (cb) => {
glob(TEST_GLOB, { cwd: src }, function (err, files) {
const modulesToLoad = files.map(function (file) {
return file.replace(/\.js$/, '');
});
define(modulesToLoad, function () { cb(null); }, cb);
const modules = [];
for (let file of files) {
if (!minimatch(file, excludeGlob)) {
modules.push(file.replace(/\.js$/, ''));
}
}
define(modules, function () { cb(null); }, cb);
});
};
}