test(aio): add async beforeEach to prevent Chrome disconnects
Related to 3d5f520ff0
from #17405
This commit is contained in:
parent
607fb1fff8
commit
2bdf2feea7
|
@ -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', () => {
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue