Skip to content

Commit 31d9a08

Browse files
authored
fix(flaky-test): Add time to beforeEach() to allow plugins to load on first pass. (#3025)
Loading plugins in beforeEach seems unwise: the it() blocks potentially run against different environments. In particular the first it() block runs with the timer already worn down by the plugin load and often the timeout hits on my mac air before the test passes.Until we can restructure this code a longer timeout avoids flaky tests.
1 parent bc9acd3 commit 31d9a08

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/unit/server.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ describe('server', () => {
1717
var fileListOnResolve = fileListOnReject = mockLauncher = null
1818
var mockFileList = mockWebServer = mockSocketServer = mockExecutor = doneSpy = null
1919

20-
beforeEach(() => {
20+
// Use regular function not arrow so 'this' is mocha 'this'.
21+
beforeEach(function () {
22+
// The first call to new Server() loads plugins and it can take >2000ms.
23+
this.timeout(4000)
2124
browserCollection = new BrowserCollection()
2225
doneSpy = sinon.spy()
2326

0 commit comments

Comments
 (0)