Skip to content

Commit

Permalink
fixup! fixup! Extract runWatch into separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Scholtes committed May 24, 2019
1 parent 2ed4cb0 commit 595b275
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cli/run-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ exports.runMocha = (
files = []
) => {
if (watch) {
watchRun(mocha, {extension, grep, ui, files, cwd});
watchRun(mocha, {extension, grep, ui, files});
} else {
exports.singleRun(mocha, {files, exit});
}
Expand Down
9 changes: 5 additions & 4 deletions lib/cli/watch-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ const Mocha = require('../mocha');
* @param {string|RegExp} [opts.grep] - Grep for test titles
* @param {string} [opts.ui] - User interface
* @param {string[]} [opts.files] - Array of test files
* @param {string} [opts.cwd] - Current working directory
* @private
*/
module.exports = (mocha, {extension, grep, ui, files, cwd}) => {
module.exports = (mocha, {extension, grep, ui, files}) => {
let runner;

console.log();
hideCursor();
process.on('SIGINT', () => {
showCursor();
console.log('\n');
process.exit(130);
// By UNIX/Posix convention this indicates that the process was
// killed by SIGINT which has portable number 2.
process.exit(128 + 2);
});

const watchFiles = utils.files(cwd, extension);
const watchFiles = utils.files(process.cwd(), extension);
let runAgain = false;

const loadAndRun = () => {
Expand Down

0 comments on commit 595b275

Please sign in to comment.