Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 2eb7a38

Browse files
bmeckiarna
authored andcommitted
feat(nodeOptions): add "nodeOptions" option to set NODE_OPTIONS for child (#7)
1 parent 7b8281a commit 2eb7a38

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ function makeEnv (data, opts, prefix, env) {
362362
)
363363
}
364364

365+
if (opts.nodeOptions) env.NODE_OPTIONS = opts.nodeOptions
366+
365367
for (i in data) {
366368
if (i.charAt(0) !== '_') {
367369
var envKey = (prefix + i).replace(/[^a-zA-Z0-9_]/g, '_')

test/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ test('makeEnv', function (t) {
2323
2424
}
2525

26-
const env = lifecycle.makeEnv(pkg, { config }, null, process.env)
26+
const env = lifecycle.makeEnv(pkg, {
27+
config,
28+
nodeOptions: '--inspect-brk --abort-on-uncaught-exception'
29+
}, null, process.env)
2730

2831
t.equal('myPackage', env.npm_package_name, 'package data is included')
2932
t.equal('Mike Sherov', env.npm_package_contributors_0_name, 'nested package data is included')
@@ -40,6 +43,8 @@ test('makeEnv', function (t) {
4043
t.equal('2', env.npm_package_config_bar, 'package config is included')
4144
t.equal('4', env.npm_package_config_baz, 'package@version config is included')
4245
t.equal('5', env.npm_package_config_foo, 'package@version config overrides package config')
46+
47+
t.equal('--inspect-brk --abort-on-uncaught-exception', env.NODE_OPTIONS, 'nodeOptions sets NODE_OPTIONS')
4348
t.end()
4449
})
4550

0 commit comments

Comments
 (0)