diff --git a/test/embedding/embedtest.cc b/test/embedding/embedtest.cc index 14e2dfb802d22c..a927167ea6a921 100644 --- a/test/embedding/embedtest.cc +++ b/test/embedding/embedtest.cc @@ -93,6 +93,7 @@ int RunNodeInstance(MultiIsolatePlatform* platform, "const publicRequire =" " require('module').createRequire(process.cwd() + '/');" "globalThis.require = publicRequire;" + "globalThis.embedVars = { nön_ascıı: '🏳️‍🌈' };" "require('vm').runInThisContext(process.argv[1]);"); if (loadenv_ret.IsEmpty()) // There has been a JS exception. diff --git a/test/embedding/test-embedding.js b/test/embedding/test-embedding.js index ac50f22e867de1..2fbaaf0ef81a49 100644 --- a/test/embedding/test-embedding.js +++ b/test/embedding/test-embedding.js @@ -6,12 +6,23 @@ const child_process = require('child_process'); const path = require('path'); common.allowGlobals(global.require); +common.allowGlobals(global.embedVars); let binary = `out/${common.buildType}/embedtest`; if (common.isWindows) { binary += '.exe'; } binary = path.resolve(__dirname, '..', '..', binary); +assert.strictEqual( + child_process.spawnSync(binary, ['console.log(42)']) + .stdout.toString().trim(), + '42'); + +assert.strictEqual( + child_process.spawnSync(binary, ['console.log(embedVars.nön_ascıı)']) + .stdout.toString().trim(), + '🏳️‍🌈'); + assert.strictEqual( child_process.spawnSync(binary, ['console.log(42)']) .stdout.toString().trim(),