33const common = require ( '../common' ) ;
44
55const fixtures = require ( '../common/fixtures' ) ;
6- const file = fixtures . path ( 'get-call-site .js' ) ;
6+ const file = fixtures . path ( 'get-call-sites .js' ) ;
77
8- const { getCallSite } = require ( 'node:util' ) ;
8+ const { getCallSites } = require ( 'node:util' ) ;
99const { spawnSync } = require ( 'node:child_process' ) ;
1010const assert = require ( 'node:assert' ) ;
1111
1212{
13- const callsite = getCallSite ( ) ;
14- assert . ok ( callsite . length > 1 ) ;
13+ const callSites = getCallSites ( ) ;
14+ assert . ok ( callSites . length > 1 ) ;
1515assert . match (
16- callsite [ 0 ] . scriptName ,
17- / t e s t - u t i l - g e t C a l l S i t e / ,
16+ callSites [ 0 ] . scriptName ,
17+ / t e s t - u t i l - g e t c a l l s i t e s / ,
1818'node:util should be ignored' ,
1919) ;
2020}
2121
2222{
23- const callsite = getCallSite ( 3 ) ;
24- assert . strictEqual ( callsite . length , 3 ) ;
23+ const callSites = getCallSites ( 3 ) ;
24+ assert . strictEqual ( callSites . length , 3 ) ;
2525assert . match (
26- callsite [ 0 ] . scriptName ,
27- / t e s t - u t i l - g e t C a l l S i t e / ,
26+ callSites [ 0 ] . scriptName ,
27+ / t e s t - u t i l - g e t c a l l s i t e s / ,
2828'node:util should be ignored' ,
2929) ;
3030}
3131
3232// Guarantee dot-left numbers are ignored
3333{
34- const callsite = getCallSite ( 3.6 ) ;
35- assert . strictEqual ( callsite . length , 3 ) ;
34+ const callSites = getCallSites ( 3.6 ) ;
35+ assert . strictEqual ( callSites . length , 3 ) ;
3636}
3737
3838{
39- const callsite = getCallSite ( 3.4 ) ;
40- assert . strictEqual ( callsite . length , 3 ) ;
39+ const callSites = getCallSites ( 3.4 ) ;
40+ assert . strictEqual ( callSites . length , 3 ) ;
4141}
4242
4343{
4444assert . throws ( ( ) => {
4545// Max than kDefaultMaxCallStackSizeToCapture
46- getCallSite ( 201 ) ;
46+ getCallSites ( 201 ) ;
4747} , common . expectsError ( {
4848code : 'ERR_OUT_OF_RANGE'
4949} ) ) ;
5050assert . throws ( ( ) => {
51- getCallSite ( - 1 ) ;
51+ getCallSites ( - 1 ) ;
5252} , common . expectsError ( {
5353code : 'ERR_OUT_OF_RANGE'
5454} ) ) ;
5555assert . throws ( ( ) => {
56- getCallSite ( { } ) ;
56+ getCallSites ( { } ) ;
5757} , common . expectsError ( {
5858code : 'ERR_INVALID_ARG_TYPE'
5959} ) ) ;
6060}
6161
6262{
63- const callsite = getCallSite ( 1 ) ;
64- assert . strictEqual ( callsite . length , 1 ) ;
63+ const callSites = getCallSites ( 1 ) ;
64+ assert . strictEqual ( callSites . length , 1 ) ;
6565assert . match (
66- callsite [ 0 ] . scriptName ,
67- / t e s t - u t i l - g e t C a l l S i t e / ,
66+ callSites [ 0 ] . scriptName ,
67+ / t e s t - u t i l - g e t c a l l s i t e s / ,
6868'node:util should be ignored' ,
6969) ;
7070}
@@ -77,8 +77,8 @@ const assert = require('node:assert');
7777'-e' ,
7878`const util = require('util');
7979 const assert = require('assert');
80- assert.ok(util.getCallSite ().length > 1);
81- process.stdout.write(util.getCallSite ()[0].scriptName);
80+ assert.ok(util.getCallSites ().length > 1);
81+ process.stdout.write(util.getCallSites ()[0].scriptName);
8282 ` ,
8383] ,
8484) ;
@@ -100,7 +100,7 @@ const assert = require('node:assert');
100100{
101101const originalStackTraceLimit = Error . stackTraceLimit ;
102102Error . stackTraceLimit = 0 ;
103- const callsite = getCallSite ( ) ;
104- assert . notStrictEqual ( callsite . length , 0 ) ;
103+ const callSites = getCallSites ( ) ;
104+ assert . notStrictEqual ( callSites . length , 0 ) ;
105105Error . stackTraceLimit = originalStackTraceLimit ;
106106}
0 commit comments