From b6b4eef2ca90d7bfaaa9f9a275c8478d3880f0b1 Mon Sep 17 00:00:00 2001 From: Outsider Date: Sun, 25 Apr 2021 18:22:20 +0900 Subject: [PATCH] apply code reviews Signed-off-by: Outsider --- test/integration/options/watch.spec.js | 36 ++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/test/integration/options/watch.spec.js b/test/integration/options/watch.spec.js index 8ab4bb4649..8e76647500 100644 --- a/test/integration/options/watch.spec.js +++ b/test/integration/options/watch.spec.js @@ -47,21 +47,17 @@ describe('--watch', function() { }); }); - it('reruns test when watched test file is crashed', function() { + it('reruns test when watched test file crashes', function() { const testFile = path.join(tempDir, 'test.js'); copyFixture(DEFAULT_FIXTURE, testFile); + replaceFileContents(testFile, 'done();', 'done((;'); + return runMochaWatchJSONAsync([testFile], tempDir, () => { - replaceFileContents(testFile, 'done();', 'done((;'); - }) - .then(() => { - return runMochaWatchJSONAsync([testFile], tempDir, () => { - replaceFileContents(testFile, 'done((;', 'done();'); - }); - }) - .then(results => { - expect(results, 'to have length', 1); - }); + replaceFileContents(testFile, 'done((;', 'done();'); + }).then(results => { + expect(results, 'to have length', 1); + }); }); describe('when in parallel mode', function() { @@ -80,17 +76,13 @@ describe('--watch', function() { const testFile = path.join(tempDir, 'test.js'); copyFixture(DEFAULT_FIXTURE, testFile); - return runMochaWatchJSONAsync(['--parallel', testFile], tempDir, () => { - replaceFileContents(testFile, 'done();', 'done((;'); - }) - .then(() => { - return runMochaWatchJSONAsync([testFile], tempDir, () => { - replaceFileContents(testFile, 'done((;', 'done();'); - }); - }) - .then(results => { - expect(results, 'to have length', 1); - }); + replaceFileContents(testFile, 'done();', 'done((;'); + + return runMochaWatchJSONAsync([testFile], tempDir, () => { + replaceFileContents(testFile, 'done((;', 'done();'); + }).then(results => { + expect(results, 'to have length', 1); + }); }); });