Skip to content

Commit

Permalink
Fixes #23183: Cannot use mocha --run anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Mar 24, 2017
1 parent fc72232 commit c0b5265
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts/test-int-mocha.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.\scripts\test.bat --run **\*.integrationTest.js -g integration %*
.\scripts\test.bat --runGlob **\*.integrationTest.js -g integration %*
2 changes: 1 addition & 1 deletion scripts/test-int-mocha.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./scripts/test.sh --run **/*.integrationTest.js -g integration "$@"
./scripts/test.sh --runGlob **/*.integrationTest.js -g integration "$@"
20 changes: 12 additions & 8 deletions test/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function main() {

var coveragePath = path.join(path.dirname(__dirname), '.build', 'coverage');
var reportTypes = [];
if (argv.run) {
if (argv.run || argv.runGlob) {
// single file running
coveragePath += '-single';
reportTypes = ['lcovonly'];
Expand Down Expand Up @@ -178,7 +178,7 @@ function main() {

var loadFunc = null;

if (argv.run) {
if (argv.runGlob) {
loadFunc = cb => {
const doRun = tests => {
const modulesToLoad = tests.map(test => {
Expand All @@ -191,11 +191,15 @@ function main() {
define(modulesToLoad, () => cb(null), cb);
};

if (typeof argv.run === 'string') {
glob(argv.run, { cwd: src }, function (err, files) { doRun(files); });
} else {
doRun(argv.run);
}
glob(argv.runGlob, { cwd: src }, function (err, files) { doRun(files); });
};
} else if (argv.run) {
var tests = (typeof argv.run === 'string') ? [argv.run] : argv.run;
var modulesToLoad = tests.map(function(test) {
return path.relative(src, path.resolve(test)).replace(/(\.js)|(\.d\.ts)|(\.js\.map)$/, '');
});
loadFunc = cb => {
define(modulesToLoad, () => cb(null), cb);
};
} else if (argv['only-monaco-editor']) {
loadFunc = function(cb) {
Expand Down Expand Up @@ -238,7 +242,7 @@ function main() {

process.stderr.write = write;

if (!argv.run) {
if (!argv.run && !argv.runGlob) {
// set up last test
suite('Loader', function () {
test('should not explode while loading', function () {
Expand Down

0 comments on commit c0b5265

Please sign in to comment.