Skip to content

Commit 2ffb5f9

Browse files
authored
test(debugger): detect bracketed byteLength at runtime (#8172)
The template integration test compared its output against a hardcoded `util.inspect` string and version-gated the bracketed `[byteLength]` form on `>=24.11.1`. The same change was later backported to Node.js v22.22.1, which broke `node-active` on master once GitHub Actions started serving v22.22.x to that job (PR CI happened to land on v22.22.0 and stayed green). Probe the current `util.inspect` output for `[byteLength]` instead, so the assertion tracks Node's actual behavior on whatever patch the runner picks up. This avoids having to enumerate every release line that backports the change. Refs: nodejs/node#60131 Refs: #8140
1 parent abf7139 commit 2ffb5f9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

integration-tests/debugger/template.spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
'use strict'
22

33
const assert = require('node:assert/strict')
4-
const semver = require('semver')
4+
const { inspect } = require('node:util')
55
const { NODE_MAJOR } = require('../../version')
66
const { setup } = require('./utils')
77

8-
const NODE_24_11_1_OR_LATER = semver.gte(process.version, '24.11.1')
8+
// Backported across LTS lines, so detect at runtime instead of version-gating.
9+
const HAS_BRACKETED_BYTELENGTH = inspect(new ArrayBuffer(0)).includes('[byteLength]')
910

1011
describe('Dynamic Instrumentation', function () {
1112
describe('template evaluation', function () {
@@ -100,7 +101,7 @@ describe('Dynamic Instrumentation', function () {
100101
messages.shift(),
101102
'ArrayBuffer { ' +
102103
'[Uint8Contents]: <00 00 00 ... 7 more bytes>, ' +
103-
(NODE_24_11_1_OR_LATER ? '[byteLength]' : 'byteLength') +
104+
(HAS_BRACKETED_BYTELENGTH ? '[byteLength]' : 'byteLength') +
104105
": 10, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9 " +
105106
'}'
106107
)

0 commit comments

Comments
 (0)