@@ -53,7 +53,17 @@ const assert = require('node:assert');
5353 code : 'ERR_OUT_OF_RANGE'
5454 } ) ) ;
5555 assert . throws ( ( ) => {
56- getCallSite ( { } ) ;
56+ getCallSite ( [ ] ) ;
57+ } , common . expectsError ( {
58+ code : 'ERR_INVALID_ARG_TYPE'
59+ } ) ) ;
60+ assert . throws ( ( ) => {
61+ getCallSite ( { } , { } ) ;
62+ } , common . expectsError ( {
63+ code : 'ERR_INVALID_ARG_TYPE'
64+ } ) ) ;
65+ assert . throws ( ( ) => {
66+ getCallSite ( 10 , 10 ) ;
5767 } , common . expectsError ( {
5868 code : 'ERR_INVALID_ARG_TYPE'
5969 } ) ) ;
@@ -104,3 +114,51 @@ const assert = require('node:assert');
104114 assert . notStrictEqual ( callsite . length , 0 ) ;
105115 Error . stackTraceLimit = originalStackTraceLimit ;
106116}
117+
118+ {
119+ const { status, stderr, stdout } = spawnSync ( process . execPath , [
120+ '--no-warnings' ,
121+ '--experimental-transform-types' ,
122+ fixtures . path ( 'typescript/ts/test-get-callsite.ts' ) ,
123+ ] ) ;
124+
125+ const output = stdout . toString ( ) ;
126+ assert . strictEqual ( stderr . toString ( ) , '' ) ;
127+ assert . match ( output , / l i n e N u m b e r : 8 / ) ;
128+ assert . match ( output , / c o l u m n : 1 8 / ) ;
129+ assert . match ( output , / t y p e s c r i p t \/ t s \/ t e s t - g e t - c a l l s i t e \. t s / ) ;
130+ assert . strictEqual ( status , 0 ) ;
131+ }
132+
133+ {
134+ const { status, stderr, stdout } = spawnSync ( process . execPath , [
135+ '--no-warnings' ,
136+ '--experimental-transform-types' ,
137+ '--no-enable-source-maps' ,
138+ fixtures . path ( 'typescript/ts/test-get-callsite.ts' ) ,
139+ ] ) ;
140+
141+ const output = stdout . toString ( ) ;
142+ assert . strictEqual ( stderr . toString ( ) , '' ) ;
143+ // Line should be wrong when sourcemaps are disable
144+ assert . match ( output , / l i n e N u m b e r : 2 / ) ;
145+ assert . match ( output , / c o l u m n : 1 8 / ) ;
146+ assert . match ( output , / t y p e s c r i p t \/ t s \/ t e s t - g e t - c a l l s i t e \. t s / ) ;
147+ assert . strictEqual ( status , 0 ) ;
148+ }
149+
150+ {
151+ // Source maps should be disabled when options.sourceMap is false
152+ const { status, stderr, stdout } = spawnSync ( process . execPath , [
153+ '--no-warnings' ,
154+ '--experimental-transform-types' ,
155+ fixtures . path ( 'typescript/ts/test-get-callsite-explicit.ts' ) ,
156+ ] ) ;
157+
158+ const output = stdout . toString ( ) ;
159+ assert . strictEqual ( stderr . toString ( ) , '' ) ;
160+ assert . match ( output , / l i n e N u m b e r : 2 / ) ;
161+ assert . match ( output , / c o l u m n : 1 8 / ) ;
162+ assert . match ( output , / t y p e s c r i p t \/ t s \/ t e s t - g e t - c a l l s i t e - e x p l i c i t \. t s / ) ;
163+ assert . strictEqual ( status , 0 ) ;
164+ }
0 commit comments