From 3d5f520ff08f00f89f323f1ec3bcd1e0c3f38596 Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Mon, 12 Jun 2017 08:44:54 +0300 Subject: [PATCH] test(aio): fix Chrome getting disconnected during unit tests Chrome (v58+) often gets disconnected during unit tests (causing them to fail). This has been happening locally (on Windows) and on Travis. The exact reasons are not known, but it seems that some of the `AppComponent` tests are to blame. Based on the discussion in https://github.com/jasmine/jasmine/issues/1327 (and plenty of trial-and-error), using Jasmine's `done()` callback before each of test (even calling it synchronously) fixes the issue. --- aio/src/app/app.component.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 531d9851a0..bb706a5793 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -59,9 +59,12 @@ describe('AppComponent', () => { describe('with proper DocViewer', () => { - beforeEach(() => { + // For reasons unknown, not using `done` (even calling it synchronously), + // causes Chrome (v58+) to often get disconnected (at least on Windows and Travis). + beforeEach(done => { createTestingModule('a/b'); initializeTest(); + done(); }); it('should create', () => {