File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -1143,12 +1143,12 @@ node --import amaro/strip --watch-path=src --watch-preserve-output --test-isolat
11431143The priority in configuration is as follows:
11441144
114511451 . NODE\_ OPTIONS and command-line options
1146- 2 . Configuration file
1147- 3 . Dotenv NODE \_ OPTIONS
1146+ 2 . Dotenv NODE \_ OPTIONS
1147+ 3 . Configuration file
11481148
11491149Values in the configuration file will not override the values in the environment
1150- variables and command-line options, but will override the values in the ` NODE_OPTIONS `
1151- env file parsed by the ` --env-file ` flag.
1150+ variables, command-line options, or the ` NODE_OPTIONS ` env file parsed by the
1151+ ` --env-file ` flag.
11521152
11531153Keys cannot be duplicated within the same or different namespaces.
11541154
Original file line number Diff line number Diff line change @@ -870,6 +870,7 @@ static ExitCode InitializeNodeWithArgsInternal(
870870 HandleEnvOptions (per_process::cli_options->per_isolate ->per_env );
871871
872872 std::string node_options;
873+ std::string node_options_from_dotenv;
873874 auto env_files = node::Dotenv::GetDataFromArgs (*argv);
874875
875876 if (!env_files.empty ()) {
@@ -896,7 +897,8 @@ static ExitCode InitializeNodeWithArgsInternal(
896897 }
897898 }
898899
899- per_process::dotenv_file.AssignNodeOptionsIfAvailable (&node_options);
900+ per_process::dotenv_file.AssignNodeOptionsIfAvailable (
901+ &node_options_from_dotenv);
900902 }
901903
902904 std::string node_options_from_config;
@@ -932,9 +934,10 @@ static ExitCode InitializeNodeWithArgsInternal(
932934 errors->emplace_back (" The number of NODE_OPTIONS doesn't match "
933935 " the number of flags in the config file" );
934936 }
935- node_options += node_options_from_config;
936937 }
937938
939+ node_options = node_options_from_config + node_options_from_dotenv;
940+
938941#if !defined(NODE_WITHOUT_NODE_OPTIONS)
939942 bool should_parse_node_options =
940943 !(flags & ProcessInitializationFlags::kDisableNodeOptionsEnv );
Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ void Dotenv::AssignNodeOptionsIfAvailable(std::string* node_options) const {
356356 auto match = store_.find (" NODE_OPTIONS" );
357357
358358 if (match != store_.end ()) {
359- *node_options = match->second ;
359+ *node_options = " " + match->second ;
360360 }
361361}
362362
Original file line number Diff line number Diff line change @@ -86,16 +86,16 @@ test('should throw an error when a flag is declared twice', async () => {
8686 assert . strictEqual ( result . code , 9 ) ;
8787} ) ;
8888
89- test ( 'should override env-file' , onlyWithAmaroAndNodeOptions , async ( ) => {
89+ test ( 'should not override env-file' , onlyWithAmaroAndNodeOptions , async ( ) => {
9090 const result = await spawnPromisified ( process . execPath , [
9191 '--no-warnings' ,
9292 `--experimental-config-file=${ fixtures . path ( 'rc/strip-types.json' ) } ` ,
9393 '--env-file' , fixtures . path ( 'dotenv/node-options-no-tranform.env' ) ,
9494 fixtures . path ( 'typescript/ts/test-typescript.ts' ) ,
9595 ] ) ;
96- assert . strictEqual ( result . stderr , '' ) ;
97- assert . match ( result . stdout , / H e l l o , T y p e S c r i p t ! / ) ;
98- assert . strictEqual ( result . code , 0 ) ;
96+ assert . match ( result . stderr , / S y n t a x E r r o r / ) ;
97+ assert . strictEqual ( result . stdout , '' ) ;
98+ assert . strictEqual ( result . code , 1 ) ;
9999} ) ;
100100
101101test ( 'should not override NODE_OPTIONS' , onlyWithAmaro , async ( ) => {
You can’t perform that action at this time.
0 commit comments