test: run unit tests in random order (#19904)

PR Close #19904
This commit is contained in:
George Kalpakas
2018-07-06 09:13:25 +03:00
committed by Miško Hevery
parent 19544060d3
commit 787c54736c
11 changed files with 94 additions and 42 deletions

View File

@ -5,8 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ApplicationRef, Compiler, Component, ComponentFactory, ComponentRef, Injector, NgModule, Testability, TestabilityRegistry} from '@angular/core';
import {TestBed, getTestBed, inject} from '@angular/core/testing';
import {Compiler, Component, ComponentFactory, Injector, NgModule, TestabilityRegistry} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import * as angular from '@angular/upgrade/src/common/angular1';
import {DowngradeComponentAdapter, groupNodesBySelector} from '@angular/upgrade/src/common/downgrade_component_adapter';
@ -82,6 +82,7 @@ withEachNg1Version(() => {
let adapter: DowngradeComponentAdapter;
let content: string;
let compiler: Compiler;
let registry: TestabilityRegistry;
let element: angular.IAugmentedJQuery;
class mockScope implements angular.IScope {
@ -168,15 +169,13 @@ withEachNg1Version(() => {
componentFactory, wrapCallback);
}
beforeEach((inject([Compiler], (inject_compiler: Compiler) => {
compiler = inject_compiler;
beforeEach(() => {
compiler = TestBed.get(Compiler);
registry = TestBed.get(TestabilityRegistry);
adapter = getAdaptor();
})));
afterEach(() => {
let registry = TestBed.get(TestabilityRegistry);
registry.unregisterAllApplications();
});
beforeEach(() => registry.unregisterAllApplications());
afterEach(() => registry.unregisterAllApplications());
it('should add testabilities hook when creating components', () => {