@@ -70,7 +70,7 @@ describe('injector', function() {
70
70
it ( 'should provide useful message if no provider' , function ( ) {
71
71
expect ( function ( ) {
72
72
injector . get ( 'idontexist' ) ;
73
- } ) . toThrow ( "[ $injector: unpr] Unknown provider: idontexistProvider <- idontexist") ;
73
+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: idontexistProvider <- idontexist") ;
74
74
} ) ;
75
75
76
76
@@ -79,7 +79,7 @@ describe('injector', function() {
79
79
providers ( 'b' , function ( a ) { return 2 ; } ) ;
80
80
expect ( function ( ) {
81
81
injector . get ( 'b' ) ;
82
- } ) . toThrow ( "[ $injector: unpr] Unknown provider: idontexistProvider <- idontexist <- a <- b") ;
82
+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: idontexistProvider <- idontexist <- a <- b") ;
83
83
} ) ;
84
84
85
85
@@ -127,10 +127,10 @@ describe('injector', function() {
127
127
it ( 'should fail with errors if not function or array' , function ( ) {
128
128
expect ( function ( ) {
129
129
injector . invoke ( { } ) ;
130
- } ) . toThrow ( "[ng: areq] Argument 'fn' is not a function, got Object") ;
130
+ } ) . toThrowMinErr ( "ng" , " areq" , " Argument 'fn' is not a function, got Object") ;
131
131
expect ( function ( ) {
132
132
injector . invoke ( [ 'a' , 123 ] , { } ) ;
133
- } ) . toThrow ( "[ng: areq] Argument 'fn' is not a function, got number") ;
133
+ } ) . toThrowMinErr ( "ng" , " areq" , " Argument 'fn' is not a function, got number") ;
134
134
} ) ;
135
135
} ) ;
136
136
@@ -268,9 +268,8 @@ describe('injector', function() {
268
268
it ( 'should error on invalid module name' , function ( ) {
269
269
expect ( function ( ) {
270
270
createInjector ( [ 'IDontExist' ] , { } ) ;
271
- } ) . toThrowMatching (
272
- / \[ \$ i n j e c t o r : m o d u l e r r \] .+ \n .* \[ \$ i n j e c t o r : n o m o d ] M o d u l e ' I D o n t E x i s t ' i s n o t a v a i l a b l e ! Y o u e i t h e r m i s s p e l l e d t h e m o d u l e n a m e o r f o r g o t t o l o a d i t /
273
- ) ;
271
+ } ) . toThrowMinErr ( '$injector' , 'modulerr' ,
272
+ / \[ \$ i n j e c t o r : n o m o d \] M o d u l e ' I D o n t E x i s t ' i s n o t a v a i l a b l e ! Y o u e i t h e r m i s s p e l l e d t h e m o d u l e n a m e o r f o r g o t t o l o a d i t / ) ;
274
273
} ) ;
275
274
276
275
@@ -553,7 +552,7 @@ describe('injector', function() {
553
552
createInjector ( [
554
553
{ }
555
554
] , { } ) ;
556
- } ) . toThrowMatching ( / \[ \ $i n j e c t o r : m o d u l e r r \] F a i l e d t o i n s t a n t i a t e m o d u l e { } d u e t o : \n .* \[ n g \ :a r e q ] A r g u m e n t ' m o d u l e ' i s n o t a f u n c t i o n , g o t O b j e c t / ) ;
555
+ } ) . toThrowMinErr ( ' $injector' , ' modulerr' , / F a i l e d t o i n s t a n t i a t e m o d u l e \{ \ } d u e t o : \n .* \[ n g : a r e q \ ] A r g u m e n t ' m o d u l e ' i s n o t a f u n c t i o n , g o t O b j e c t / ) ;
557
556
} ) ;
558
557
559
558
@@ -562,16 +561,16 @@ describe('injector', function() {
562
561
createInjector ( [ function ( ) {
563
562
throw 'MyError' ;
564
563
} ] , { } ) ;
565
- } ) . toThrowMatching ( / \[ \ $i n j e c t o r : m o d u l e r r \] F a i l e d t o i n s t a n t i a t e m o d u l e .+ d u e t o : \n .* M y E r r o r / ) ;
564
+ } ) . toThrowMinErr ( ' $injector' , ' modulerr' , / F a i l e d t o i n s t a n t i a t e m o d u l e .+ d u e t o : \n .* M y E r r o r / ) ;
566
565
} ) ;
567
566
568
567
569
568
it ( 'should decorate the missing service error with module name' , function ( ) {
570
569
angular . module ( 'TestModule' , [ ] , function ( xyzzy ) { } ) ;
571
570
expect ( function ( ) {
572
571
createInjector ( [ 'TestModule' ] ) ;
573
- } ) . toThrowMatching (
574
- / \[ \ $i n j e c t o r : m o d u l e r r \] F a i l e d t o i n s t a n t i a t e m o d u l e T e s t M o d u l e d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
572
+ } ) . toThrowMinErr (
573
+ ' $injector' , ' modulerr' , / F a i l e d t o i n s t a n t i a t e m o d u l e T e s t M o d u l e d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
575
574
) ;
576
575
} ) ;
577
576
@@ -580,8 +579,8 @@ describe('injector', function() {
580
579
function myModule ( xyzzy ) { }
581
580
expect ( function ( ) {
582
581
createInjector ( [ myModule ] ) ;
583
- } ) . toThrowMatching (
584
- / \[ \ $i n j e c t o r : m o d u l e r r \] F a i l e d t o i n s t a n t i a t e m o d u l e f u n c t i o n m y M o d u l e \( x y z z y \) d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
582
+ } ) . toThrowMinErr (
583
+ ' $injector' , ' modulerr' , / F a i l e d t o i n s t a n t i a t e m o d u l e f u n c t i o n m y M o d u l e \( x y z z y \) d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
585
584
) ;
586
585
} ) ;
587
586
@@ -590,8 +589,8 @@ describe('injector', function() {
590
589
function myModule ( xyzzy ) { }
591
590
expect ( function ( ) {
592
591
createInjector ( [ [ 'xyzzy' , myModule ] ] ) ;
593
- } ) . toThrowMatching (
594
- / \[ \ $i n j e c t o r : m o d u l e r r \] F a i l e d t o i n s t a n t i a t e m o d u l e f u n c t i o n m y M o d u l e \( x y z z y \) d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
592
+ } ) . toThrowMinErr (
593
+ ' $injector' , ' modulerr' , / F a i l e d t o i n s t a n t i a t e m o d u l e f u n c t i o n m y M o d u l e \( x y z z y \) d u e t o : \n .* \[ \$ i n j e c t o r : u n p r ] U n k n o w n p r o v i d e r : x y z z y /
595
594
) ;
596
595
} ) ;
597
596
@@ -602,7 +601,7 @@ describe('injector', function() {
602
601
$provide . factory ( 'service' , function ( service ) { } ) ;
603
602
return function ( service ) { }
604
603
} ] )
605
- } ) . toThrow ( "[ $injector: cdep] Circular dependency found: service" ) ;
604
+ } ) . toThrowMinErr ( ' $injector' , ' cdep' , ' Circular dependency found: service' ) ;
606
605
} ) ;
607
606
608
607
@@ -613,7 +612,7 @@ describe('injector', function() {
613
612
$provide . factory ( 'b' , function ( a ) { } ) ;
614
613
return function ( a ) { }
615
614
} ] )
616
- } ) . toThrow ( '[ $injector: cdep] Circular dependency found: b <- a') ;
615
+ } ) . toThrowMinErr ( ' $injector' , ' cdep' , ' Circular dependency found: b <- a') ;
617
616
} ) ;
618
617
} ) ;
619
618
} ) ;
@@ -703,7 +702,7 @@ describe('injector', function() {
703
702
it ( 'should throw usefull error on wrong argument type]' , function ( ) {
704
703
expect ( function ( ) {
705
704
$injector . invoke ( { } ) ;
706
- } ) . toThrow ( "[ng: areq] Argument 'fn' is not a function, got Object") ;
705
+ } ) . toThrowMinErr ( "ng" , " areq" , " Argument 'fn' is not a function, got Object") ;
707
706
} ) ;
708
707
} ) ;
709
708
@@ -790,15 +789,15 @@ describe('injector', function() {
790
789
} ] ) ;
791
790
expect ( function ( ) {
792
791
$injector . get ( 'nameProvider' ) ;
793
- } ) . toThrow ( "[ $injector: unpr] Unknown provider: nameProviderProvider <- nameProvider") ;
792
+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: nameProviderProvider <- nameProvider") ;
794
793
} ) ;
795
794
796
795
797
796
it ( 'should prevent provider configuration in app' , function ( ) {
798
797
var $injector = createInjector ( [ ] ) ;
799
798
expect ( function ( ) {
800
799
$injector . get ( '$provide' ) . value ( 'a' , 'b' ) ;
801
- } ) . toThrow ( "[ $injector: unpr] Unknown provider: $provideProvider <- $provide") ;
800
+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: $provideProvider <- $provide") ;
802
801
} ) ;
803
802
804
803
0 commit comments