Skip to content

Commit

Permalink
process: unify experimental warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
RedYetiDev committed Jul 2, 2024
1 parent 66b76e2 commit 78157ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/internal/process/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {
exposeLazyInterfaces,
defineReplaceableLazyAttribute,
setupCoverageHooks,
emitExperimentalWarning,
} = require('internal/util');

const {
Expand Down Expand Up @@ -538,8 +539,7 @@ function initializePermission() {
};
// Guarantee path module isn't monkey-patched to bypass permission model
ObjectFreeze(require('path'));
process.emitWarning('Permission is an experimental feature',
'ExperimentalWarning');
emitExperimentalWarning('Permission');
const { has } = require('internal/process/permission');
const warnFlags = [
'--allow-addons',
Expand Down Expand Up @@ -628,8 +628,7 @@ function initializeSourceMapsHandlers() {

function initializeFrozenIntrinsics() {
if (getOptionValue('--frozen-intrinsics')) {
process.emitWarning('The --frozen-intrinsics flag is experimental',
'ExperimentalWarning');
emitExperimentalWarning('Frozen intristics');
require('internal/freeze_intrinsics')();
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-permission-experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ const assert = require('assert');
// when using permission system

process.on('warning', common.mustCall((warning) => {
assert.match(warning.message, /Permission is an experimental feature/);
assert.strictEqual(warning.name, 'ExperimentalWarning');
}, 1));

0 comments on commit 78157ae

Please sign in to comment.