Skip to content

Commit f3cf426

Browse files
authored
[DI] Fix tests in Node.js 24 (#5689)
1 parent 052bdaa commit f3cf426

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

integration-tests/debugger/template.spec.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ describe('Dynamic Instrumentation', function () {
5151
'foo: [Object], ' +
5252
'bar: true, ' +
5353
'baz: [Getter], ' +
54-
'[Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] ' +
54+
(NODE_MAJOR >= 24
55+
? 'Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] '
56+
: '[Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] ') +
5557
'}'
5658
)
5759
assert.strictEqual(messages.shift(), obj) // a proxy should just be stringified to the wrapped object
@@ -61,14 +63,18 @@ describe('Dynamic Instrumentation', function () {
6163
// `util.inspect`, but it has not been considered a big side-effects issue, as anyone implementing this
6264
// function is doing so with the explicit intent of modifying the string representation of instances.
6365
assert.strictEqual(messages.shift(), 'CustomClass [foo] { b: 2, c: 3 }')
64-
// Full promise example string (line breaks added for readability):
65-
// Promise {
66-
// 42,
67-
// [Symbol(async_id_symbol)]: 205,
68-
// [Symbol(trigger_async_id_symbol)]: 204,
69-
// [Symbol(kResourceStore)]: {}
70-
// }
71-
assert.ok(messages.shift().startsWith('Promise { 42, '))
66+
if (NODE_MAJOR >= 24) {
67+
assert.strictEqual(messages.shift(), 'Promise { 42 }')
68+
} else {
69+
// Full promise example string (line breaks added for readability):
70+
// Promise {
71+
// 42,
72+
// [Symbol(async_id_symbol)]: 205,
73+
// [Symbol(trigger_async_id_symbol)]: 204,
74+
// [Symbol(kResourceStore)]: {}
75+
// }
76+
assert.ok(messages.shift().startsWith('Promise { 42, '))
77+
}
7278
assert.strictEqual(messages.shift(), '[Function: arrowFn]')
7379
assert.strictEqual(messages.shift(), '[Function: fn]')
7480
assert.strictEqual(

0 commit comments

Comments
 (0)