Skip to content

Commit 902cbe6

Browse files
legendecasRafaelGSS
authored andcommitted
src: fix EnvironmentOptions.async_context_frame default value
`default_is_true` in bool OptionsParser is a hint for help text. The default value for an option is still required to be set in the option struct. PR-URL: #58030 Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
1 parent b5b1923 commit 902cbe6

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/node_options.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class EnvironmentOptions : public Options {
146146
bool allow_worker_threads = false;
147147
bool experimental_repl_await = true;
148148
bool experimental_vm_modules = false;
149-
bool async_context_frame = false;
149+
bool async_context_frame = true;
150150
bool expose_internals = false;
151151
bool force_node_api_uncaught_exceptions_policy = false;
152152
bool frozen_intrinsics = false;
@@ -408,6 +408,10 @@ class OptionsParser {
408408
// These methods add a single option to the parser. Optionally, it can be
409409
// specified whether the option should be allowed from environment variable
410410
// sources (i.e. NODE_OPTIONS).
411+
412+
// default_is_true is only a hint in printing help text, it does not
413+
// affect the default value of the option. Set the default value in the
414+
// Options struct instead.
411415
void AddOption(const char* name,
412416
const char* help_text,
413417
bool Options::*field,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Flags: --expose-internals --no-async-context-frame
2+
'use strict';
3+
4+
require('../common');
5+
const assert = require('assert');
6+
const AsyncContextFrame = require('internal/async_context_frame');
7+
8+
// Test that AsyncContextFrame can be disabled.
9+
assert(!AsyncContextFrame.enabled);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
4+
require('../common');
5+
const assert = require('assert');
6+
const AsyncContextFrame = require('internal/async_context_frame');
7+
8+
// Test that AsyncContextFrame is enabled by default.
9+
assert(AsyncContextFrame.enabled);

0 commit comments

Comments
 (0)