Skip to content

Commit 81aed1c

Browse files
committed
Use color on rerunMessage and add sinon spy for logger.write
1 parent 7587b3b commit 81aed1c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/watcher.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
const chalk = require('chalk');
23
const nodePath = require('path');
34
const debug = require('debug')('ava:watcher');
45
const diff = require('lodash.difference');
@@ -18,6 +19,8 @@ function rethrowAsync(err) {
1819

1920
const MIN_DEBOUNCE_DELAY = 10;
2021
const INITIAL_DEBOUNCE_DELAY = 100;
22+
const rerunMessage = chalk.gray.dim("To rerun all tests, type 'r', followed by Enter\nTo update snapshots used in the previous tests, type 'u', followed by Enter\n");
23+
2124

2225
class Debouncer {
2326
constructor(watcher) {
@@ -126,7 +129,7 @@ class Watcher {
126129
.then(runStatus => {
127130
runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
128131
logger.finish(runStatus);
129-
logger.write('[ava] To rerun tests, enter `r`\n[ava] To update snapshots used in the previous test run, enter `u`');
132+
logger.write(rerunMessage);
130133

131134
const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
132135
this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;

test/watcher.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ group('chokidar', (beforeEach, test, group) => {
7878
finish: sinon.spy(),
7979
section: sinon.spy(),
8080
clear: sinon.stub().returns(true),
81-
reset: sinon.spy()
81+
reset: sinon.spy(),
82+
write: sinon.spy()
8283
};
8384

8485
api = {

0 commit comments

Comments
 (0)