node/test/parallel/test-config-json-schema.js
James M Snell b4af647920 quic: reduce boilerplate and other minor cleanups
While I get that macros aren't the most loved thing in
the world, they do help reduce boilerplate, and there's
a lot of boilerplate in the QUIC code. This commit cleans
up some of that boilerplate, particularly around the
use of v8 APIs.

PR-URL: https://github.com/nodejs/node/pull/59342
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2025-09-07 19:29:02 -07:00

45 lines
1.3 KiB
JavaScript

// Flags: --no-warnings --expose-internals
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const { hasOpenSSL3 } = require('../common/crypto');
if (!hasOpenSSL3) {
common.skip('this test requires OpenSSL 3.x');
}
if (!common.hasIntl) {
// A handful of the tests fail when ICU is not included.
common.skip('missing Intl');
}
if (!common.hasQuic) {
common.skip('this test requires QUIC');
}
const {
generateConfigJsonSchema,
} = require('internal/options');
const schemaInDoc = require('../../doc/node-config-schema.json');
const assert = require('assert');
const schema = generateConfigJsonSchema();
// This assertion ensures that whenever we add a new env option, we also add it
// to the JSON schema. The function getEnvOptionsInputType() returns all the available
// env options, so we can generate the JSON schema from it and compare it to the
// current JSON schema.
// To regenerate the JSON schema, run:
// out/Release/node --expose-internals tools/doc/generate-json-schema.mjs
// And then run make doc to update the out/doc/node-config-schema.json file.
assert.strictEqual(JSON.stringify(schema), JSON.stringify(schemaInDoc), 'JSON schema is outdated.' +
'Run `out/Release/node --expose-internals tools/doc/generate-json-schema.mjs` to update it.');