diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index c076632c38..86e9dac62a 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -59,12 +59,9 @@ describe('AppComponent', () => { describe('with proper DocViewer', () => { - // 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 => { + beforeEach(() => { createTestingModule('a/b'); initializeTest(); - done(); }); it('should create', () => { diff --git a/aio/src/test.ts b/aio/src/test.ts index 722acc0395..b545af8bab 100644 --- a/aio/src/test.ts +++ b/aio/src/test.ts @@ -42,6 +42,14 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting() ); +// HACK: Chrome 59 disconnects if there are too many synchronous tests in a row +// because it appears to lock up the thread that communicates to Karma's socket +// This async beforeEach gets called on every spec and releases the JS thread long +// enough for the socket to continue to communicate. +// The downside is that it creates a minor performance penalty of around 10-15% +// increase in the time it takes to run out unit tests. +beforeEach((done) => done()); + declare var System: any; // Then we find all the tests. System.import('./test-specs.ts')