1- import { ChainError } from '../src/ chain-error' ;
2- import { cleanStack } from './common' ;
1+ import { ChainError } from '#lib/ chain-error.js ' ;
2+ import { cleanStack } from './common.js ' ;
33
44// tslint:disable: no-unused-expression
55
@@ -14,7 +14,7 @@ describe('ChainError:', () => {
1414 * which are more than the default (10 frames) in Node v6.x.
1515 */
1616 Error . stackTraceLimit = 20 ;
17- nodestack = new Error ( ) . stack . split ( '\n' ) . slice ( 4 ) . join ( '\n' ) ;
17+ nodestack = new Error ( ) . stack ! . split ( '\n' ) . slice ( 4 ) . join ( '\n' ) ;
1818 nodestack = cleanStack ( nodestack ) ;
1919 } ) ;
2020
@@ -29,16 +29,16 @@ describe('ChainError:', () => {
2929
3030 it ( 'caused by another error, with annotation' , ( ) => {
3131 const suberr = new Error ( 'root cause' ) ;
32- const err = new ChainError ( ` proximate cause: 3 issues` , suberr ) ;
32+ const err = new ChainError ( ' proximate cause: 3 issues' , suberr ) ;
3333 expect ( err . message ) . toEqual ( 'proximate cause: 3 issues: root cause' ) ;
34- const actualStack = cleanStack ( err . stack ) ;
34+ const actualStack = cleanStack ( err . stack ! ) ;
3535 const expectedStack = `ChainError: proximate cause: 3 issues: root cause\n (dummy filename)\n${ nodestack } ` ;
3636 expect ( actualStack ) . toBe ( expectedStack ) ;
3737 } ) ;
3838
3939 it ( 'caused by another ChainError, with annotation' , ( ) => {
4040 const suberr1 = new Error ( 'root cause' ) ;
41- const suberr2 = new ChainError ( ` proximate cause: 3 issues` , suberr1 ) ;
41+ const suberr2 = new ChainError ( ' proximate cause: 3 issues' , suberr1 ) ;
4242 let err = new ChainError ( 'top' , suberr2 ) ;
4343 expect ( err . message ) . toEqual ( 'top: proximate cause: 3 issues: root cause' ) ;
4444
@@ -66,7 +66,7 @@ describe('ChainError:', () => {
6666 it ( 'no arguments' , ( ) => {
6767 const err = new ChainError ( null , null , true ) ;
6868 expect ( err . toString ( ) ) . toEqual ( 'ChainError' ) ;
69- const stack = cleanStack ( err . stack ) ;
69+ const stack = cleanStack ( err . stack ! ) ;
7070 expect ( stack ) . toEqual ( `ChainError: \n (dummy filename)\n${ nodestack } ` ) ;
7171 } ) ;
7272
@@ -78,7 +78,7 @@ describe('ChainError:', () => {
7878 err = new ChainError ( 'my error' , null , true ) ;
7979 expect ( err . message ) . toEqual ( 'my error' ) ;
8080 expect ( err . toString ( ) ) . toEqual ( 'ChainError: my error' ) ;
81- const stack = cleanStack ( err . stack ) ;
81+ const stack = cleanStack ( err . stack ! ) ;
8282 expect ( stack ) . toEqual ( `ChainError: my error\n (dummy filename)\n${ nodestack } ` ) ;
8383
8484 err = new ChainError ( 'my error' , { } , true ) ;
@@ -98,22 +98,22 @@ describe('ChainError:', () => {
9898
9999 it ( 'caused by another error, with annotation' , ( ) => {
100100 const suberr = new Error ( 'root cause' ) ;
101- let err = new ChainError ( ` proximate cause: 3 issues` , suberr , true ) ;
101+ let err = new ChainError ( ' proximate cause: 3 issues' , suberr , true ) ;
102102 expect ( err . message ) . toEqual ( 'proximate cause: 3 issues' ) ;
103103 expect ( err . toString ( ) ) . toEqual ( 'ChainError: proximate cause: 3 issues; caused by Error: root cause' ) ;
104- let stack = cleanStack ( err . stack ) ;
104+ let stack = cleanStack ( err . stack ! ) ;
105105 expect ( stack ) . toEqual ( `ChainError: proximate cause: 3 issues\n (dummy filename)\n${ nodestack } ` ) ;
106106
107- err = new ChainError ( ` proximate cause: 3 issues` , { cause : suberr } , true ) ;
107+ err = new ChainError ( ' proximate cause: 3 issues' , { cause : suberr } , true ) ;
108108 expect ( err . message ) . toEqual ( 'proximate cause: 3 issues' ) ;
109109 expect ( err . toString ( ) ) . toEqual ( 'ChainError: proximate cause: 3 issues; caused by Error: root cause' ) ;
110- stack = cleanStack ( err . stack ) ;
110+ stack = cleanStack ( err . stack ! ) ;
111111 expect ( stack ) . toEqual ( `ChainError: proximate cause: 3 issues\n (dummy filename)\n${ nodestack } ` ) ;
112112 } ) ;
113113
114114 it ( 'caused by another ChainError, with annotation' , ( ) => {
115115 const suberr1 = new Error ( 'root cause' ) ;
116- const suberr = new ChainError ( ` proximate cause: 3 issues` , { cause : suberr1 } , true ) ;
116+ const suberr = new ChainError ( ' proximate cause: 3 issues' , { cause : suberr1 } , true ) ;
117117 let err = new ChainError ( 'top' , suberr , true ) ;
118118 expect ( err . message ) . toEqual ( 'top' ) ;
119119 let actualStack = err . toString ( ) ;
0 commit comments