Skip to content

Commit

Permalink
Removed confusing files requirement for cli run
Browse files Browse the repository at this point in the history
  • Loading branch information
rijnhard committed Dec 22, 2017
1 parent 0a0fc96 commit f1cc4bd
Show file tree
Hide file tree
Showing 3 changed files with 6,054 additions and 6,059 deletions.
4 changes: 2 additions & 2 deletions bin/_mocha
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ cli.setMochaOptions(
opts
);

var files = cli.resolveFiles(program.args, opts);
mocha.files = cli.resolveFiles(program.args, opts);

try {
cli.run(mocha, program, files);
cli.run(mocha, program);
} catch (e) {
console.error(e.message);
process.exit(1);
Expand Down
13 changes: 3 additions & 10 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,19 +413,15 @@ exports.setMochaOptions = function (mocha, program) {

/**
* runs/watch mocha.
* call after parsing options in Command
* call after parsing options in Command,
* resolved files need to have been added to mocha manually
*
* @param {Mocha} mocha instance to run
* @param {*} options parsed options to set (from program._opts())
* @param {string[]} files resolved files from resolveFiles
*/
exports.run = function (mocha, options, files) {
exports.run = function (mocha, options) {
Error.stackTraceLimit = Infinity; // TODO: config

if (!files.length) {
throw new Error('No test files found');
}

process.on('SIGINT', function () {
runner.abort();

Expand Down Expand Up @@ -456,7 +452,6 @@ exports.run = function (mocha, options, files) {

loadAndRun = function loadAndRun () {
try {
mocha.files = files;
runAgain = false;
runner = mocha.run(function () {
runner = null;
Expand Down Expand Up @@ -499,8 +494,6 @@ exports.run = function (mocha, options, files) {
});
} else {
// load

mocha.files = files;
runner = mocha.run(options.exit ? exit : exitLater);
}
};
Expand Down

0 comments on commit f1cc4bd

Please sign in to comment.