fix(#321): replace JSON config default clone with structuredClone (#324)

This commit is contained in:
Tom Boucher
2026-05-26 12:22:02 -04:00
committed by GitHub
parent e4f29feabc
commit e5a5a75938
3 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
'use strict';
const { test } = require('node:test');
const assert = require('node:assert/strict');
const configuration = require('../get-shit-done/bin/lib/configuration.cjs');
test('mergeDefaults clones defaults without JSON serialization fragility (#321)', () => {
const sentinelKey = '__bug321_bigint_sentinel__';
const sentinelValue = BigInt('9007199254740993001');
configuration.CONFIG_DEFAULTS[sentinelKey] = sentinelValue;
try {
const merged = configuration.mergeDefaults({});
assert.equal(
merged[sentinelKey],
sentinelValue,
'mergeDefaults must preserve non-JSON scalar defaults when cloning'
);
}
finally {
delete configuration.CONFIG_DEFAULTS[sentinelKey];
}
});