@@ -70,7 +70,7 @@ describe('injector', function() {
7070 it ( 'should provide useful message if no provider' , function ( ) {
7171 expect ( function ( ) {
7272 injector . get ( 'idontexist' ) ;
73- } ) . toThrow ( "[ $injector: unpr] Unknown provider: idontexistProvider <- idontexist") ;
73+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: idontexistProvider <- idontexist") ;
7474 } ) ;
7575
7676
@@ -79,7 +79,7 @@ describe('injector', function() {
7979 providers ( 'b' , function ( a ) { return 2 ; } ) ;
8080 expect ( function ( ) {
8181 injector . get ( 'b' ) ;
82- } ) . toThrow ( "[ $injector: unpr] Unknown provider: idontexistProvider <- idontexist <- a <- b") ;
82+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: idontexistProvider <- idontexist <- a <- b") ;
8383 } ) ;
8484
8585
@@ -127,10 +127,10 @@ describe('injector', function() {
127127 it ( 'should fail with errors if not function or array' , function ( ) {
128128 expect ( function ( ) {
129129 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") ;
131131 expect ( function ( ) {
132132 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") ;
134134 } ) ;
135135 } ) ;
136136
@@ -268,9 +268,8 @@ describe('injector', function() {
268268 it ( 'should error on invalid module name' , function ( ) {
269269 expect ( function ( ) {
270270 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 / ) ;
274273 } ) ;
275274
276275
@@ -553,7 +552,7 @@ describe('injector', function() {
553552 createInjector ( [
554553 { }
555554 ] , { } ) ;
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 / ) ;
557556 } ) ;
558557
559558
@@ -562,16 +561,16 @@ describe('injector', function() {
562561 createInjector ( [ function ( ) {
563562 throw 'MyError' ;
564563 } ] , { } ) ;
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 / ) ;
566565 } ) ;
567566
568567
569568 it ( 'should decorate the missing service error with module name' , function ( ) {
570569 angular . module ( 'TestModule' , [ ] , function ( xyzzy ) { } ) ;
571570 expect ( function ( ) {
572571 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 /
575574 ) ;
576575 } ) ;
577576
@@ -580,8 +579,8 @@ describe('injector', function() {
580579 function myModule ( xyzzy ) { }
581580 expect ( function ( ) {
582581 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 /
585584 ) ;
586585 } ) ;
587586
@@ -590,8 +589,8 @@ describe('injector', function() {
590589 function myModule ( xyzzy ) { }
591590 expect ( function ( ) {
592591 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 /
595594 ) ;
596595 } ) ;
597596
@@ -602,7 +601,7 @@ describe('injector', function() {
602601 $provide . factory ( 'service' , function ( service ) { } ) ;
603602 return function ( service ) { }
604603 } ] )
605- } ) . toThrow ( "[ $injector: cdep] Circular dependency found: service" ) ;
604+ } ) . toThrowMinErr ( ' $injector' , ' cdep' , ' Circular dependency found: service' ) ;
606605 } ) ;
607606
608607
@@ -613,7 +612,7 @@ describe('injector', function() {
613612 $provide . factory ( 'b' , function ( a ) { } ) ;
614613 return function ( a ) { }
615614 } ] )
616- } ) . toThrow ( '[ $injector: cdep] Circular dependency found: b <- a') ;
615+ } ) . toThrowMinErr ( ' $injector' , ' cdep' , ' Circular dependency found: b <- a') ;
617616 } ) ;
618617 } ) ;
619618 } ) ;
@@ -703,7 +702,7 @@ describe('injector', function() {
703702 it ( 'should throw usefull error on wrong argument type]' , function ( ) {
704703 expect ( function ( ) {
705704 $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") ;
707706 } ) ;
708707 } ) ;
709708
@@ -790,15 +789,15 @@ describe('injector', function() {
790789 } ] ) ;
791790 expect ( function ( ) {
792791 $injector . get ( 'nameProvider' ) ;
793- } ) . toThrow ( "[ $injector: unpr] Unknown provider: nameProviderProvider <- nameProvider") ;
792+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: nameProviderProvider <- nameProvider") ;
794793 } ) ;
795794
796795
797796 it ( 'should prevent provider configuration in app' , function ( ) {
798797 var $injector = createInjector ( [ ] ) ;
799798 expect ( function ( ) {
800799 $injector . get ( '$provide' ) . value ( 'a' , 'b' ) ;
801- } ) . toThrow ( "[ $injector: unpr] Unknown provider: $provideProvider <- $provide") ;
800+ } ) . toThrowMinErr ( " $injector" , " unpr" , " Unknown provider: $provideProvider <- $provide") ;
802801 } ) ;
803802
804803
0 commit comments