diff --git a/test/integration/options/watch.spec.js b/test/integration/options/watch.spec.js index 53dd9900c3..d46b4c7df2 100644 --- a/test/integration/options/watch.spec.js +++ b/test/integration/options/watch.spec.js @@ -115,6 +115,20 @@ describe('--watch', function() { expect(results[1].failures, 'to have length', 1); }); }); + + // Regresseion test for https://github.com/mochajs/mocha/issues/2027 + it('respects --fgrep on re-runs', function() { + const testFile = path.join(this.tempDir, 'test.js'); + copyFixture('options/grep', testFile); + + return runMochaWatch([testFile, '--fgrep', 'match'], this.tempDir, () => { + touchFile(testFile); + }).then(results => { + expect(results, 'to have length', 2); + expect(results[0].tests, 'to have length', 2); + expect(results[1].tests, 'to have length', 2); + }); + }); }); });