node/test/parallel/test-os-constants-signals.js
Xavier Stouder 972a1107c0
os: freeze signals constant
Remove the ability to mutate signals constant as doing so can lead to
unexpected behavior, notably when spawning child process.

Fixes: https://github.com/nodejs/node/issues/44749
PR-URL: https://github.com/nodejs/node/pull/61038
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-02-24 00:37:08 +01:00

11 lines
288 B
JavaScript

'use strict';
require('../common');
const { test } = require('node:test');
const assert = require('node:assert');
const { constants } = require('node:os');
test('Verify that signals constant is immutable', () => {
assert.throws(() => constants.signals.FOOBAR = 1337, TypeError);
});