@@ -11,7 +11,6 @@ import {
11
11
afterRender ,
12
12
ClassProvider ,
13
13
Component ,
14
- createEnvironmentInjector ,
15
14
Directive ,
16
15
ElementRef ,
17
16
inject ,
@@ -44,8 +43,6 @@ import {
44
43
InjectorProfilerEventType ,
45
44
ProviderConfiguredEvent ,
46
45
setInjectorProfiler ,
47
- injectorProfiler ,
48
- InjectorProfilerContext ,
49
46
} from '../../src/render3/debug/injector_profiler' ;
50
47
import { getNodeInjectorLView , NodeInjector } from '../../src/render3/di' ;
51
48
import {
@@ -106,7 +103,7 @@ describe('setProfiler', () => {
106
103
} ) ;
107
104
} ) ;
108
105
109
- afterEach ( ( ) => setInjectorProfiler ( null ) ) ;
106
+ afterAll ( ( ) => setInjectorProfiler ( null ) ) ;
110
107
111
108
it ( 'should emit DI events when a component contains a provider and injects it' , ( ) => {
112
109
class MyService { }
@@ -385,70 +382,6 @@ describe('setProfiler', () => {
385
382
} ) ;
386
383
} ) ;
387
384
388
- describe ( 'profiler activation and removal' , ( ) => {
389
- class SomeClass { }
390
-
391
- const fakeContext : InjectorProfilerContext = {
392
- injector : Injector . create ( { providers : [ ] } ) ,
393
- token : SomeClass ,
394
- } ;
395
-
396
- const fakeEvent : InjectorCreatedInstanceEvent = {
397
- type : InjectorProfilerEventType . InstanceCreatedByInjector ,
398
- context : fakeContext ,
399
- instance : { value : new SomeClass ( ) } ,
400
- } ;
401
-
402
- it ( 'should allow adding and removing multiple profilers' , ( ) => {
403
- const events : string [ ] = [ ] ;
404
- const r1 = setInjectorProfiler ( ( e ) => events . push ( 'P1: ' + e . type ) ) ;
405
- const r2 = setInjectorProfiler ( ( e ) => events . push ( 'P2: ' + e . type ) ) ;
406
-
407
- injectorProfiler ( fakeEvent ) ;
408
- expect ( events ) . toEqual ( [ 'P1: 1' , 'P2: 1' ] ) ;
409
-
410
- r1 ( ) ;
411
- injectorProfiler ( fakeEvent ) ;
412
- expect ( events ) . toEqual ( [ 'P1: 1' , 'P2: 1' , 'P2: 1' ] ) ;
413
-
414
- r2 ( ) ;
415
- injectorProfiler ( fakeEvent ) ;
416
- expect ( events ) . toEqual ( [ 'P1: 1' , 'P2: 1' , 'P2: 1' ] ) ;
417
- } ) ;
418
-
419
- it ( 'should not add / remove the same profiler twice' , ( ) => {
420
- const events : string [ ] = [ ] ;
421
- const p1 = ( e : InjectorProfilerEvent ) => events . push ( 'P1: ' + e . type ) ;
422
- const r1 = setInjectorProfiler ( p1 ) ;
423
- const r2 = setInjectorProfiler ( p1 ) ;
424
-
425
- injectorProfiler ( fakeEvent ) ;
426
- expect ( events ) . toEqual ( [ 'P1: 1' ] ) ;
427
-
428
- r1 ( ) ;
429
- injectorProfiler ( fakeEvent ) ;
430
- expect ( events ) . toEqual ( [ 'P1: 1' ] ) ;
431
-
432
- // subsequent removals should be noop
433
- r1 ( ) ;
434
- r2 ( ) ;
435
- } ) ;
436
-
437
- it ( 'should clear all profilers when passing null' , ( ) => {
438
- const events : string [ ] = [ ] ;
439
- setInjectorProfiler ( ( e ) => events . push ( 'P1: ' + e . type ) ) ;
440
- setInjectorProfiler ( ( e ) => events . push ( 'P2: ' + e . type ) ) ;
441
-
442
- injectorProfiler ( fakeEvent ) ;
443
- expect ( events ) . toEqual ( [ 'P1: 1' , 'P2: 1' ] ) ;
444
-
445
- // clear all profilers
446
- setInjectorProfiler ( null ) ;
447
- injectorProfiler ( fakeEvent ) ;
448
- expect ( events ) . toEqual ( [ 'P1: 1' , 'P2: 1' ] ) ;
449
- } ) ;
450
- } ) ;
451
-
452
385
describe ( 'getInjectorMetadata' , ( ) => {
453
386
it ( 'should be able to determine injector type and name' , fakeAsync ( ( ) => {
454
387
class MyServiceA { }
@@ -554,7 +487,7 @@ describe('getInjectorMetadata', () => {
554
487
555
488
describe ( 'getInjectorProviders' , ( ) => {
556
489
beforeEach ( ( ) => setupFrameworkInjectorProfiler ( ) ) ;
557
- afterEach ( ( ) => setInjectorProfiler ( null ) ) ;
490
+ afterAll ( ( ) => setInjectorProfiler ( null ) ) ;
558
491
559
492
it ( 'should be able to get the providers from a components injector' , ( ) => {
560
493
class MyService { }
@@ -1020,7 +953,7 @@ describe('getInjectorProviders', () => {
1020
953
1021
954
describe ( 'getDependenciesFromInjectable' , ( ) => {
1022
955
beforeEach ( ( ) => setupFrameworkInjectorProfiler ( ) ) ;
1023
- afterEach ( ( ) => setInjectorProfiler ( null ) ) ;
956
+ afterAll ( ( ) => setInjectorProfiler ( null ) ) ;
1024
957
1025
958
it ( 'should be able to determine which injector dependencies come from' , fakeAsync ( ( ) => {
1026
959
class MyService { }
@@ -1311,7 +1244,7 @@ describe('getDependenciesFromInjectable', () => {
1311
1244
1312
1245
describe ( 'getInjectorResolutionPath' , ( ) => {
1313
1246
beforeEach ( ( ) => setupFrameworkInjectorProfiler ( ) ) ;
1314
- afterEach ( ( ) => setInjectorProfiler ( null ) ) ;
1247
+ afterAll ( ( ) => setInjectorProfiler ( null ) ) ;
1315
1248
1316
1249
it ( 'should be able to inspect injector hierarchy structure' , fakeAsync ( ( ) => {
1317
1250
class MyServiceA { }
0 commit comments