Ignore transformation of process.env.* (#1367)

This commit is contained in:
Timofey Kachalov
2026-01-06 23:37:42 +04:00
committed by GitHub
parent 90362a2555
commit c844f97cfc
16 changed files with 134 additions and 12 deletions
@@ -721,6 +721,24 @@ describe('JavaScriptObfuscator', () => {
});
});
describe('process.env.* support', () => {
const regExp: RegExp = /console\['log']\(process\.env\.FOO\);/;
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/process-env.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(code, {
...NO_ADDITIONAL_NODES_PRESET
}).getObfuscatedCode();
});
it('should not obfuscate `process.env.*`', () => {
assert.match(obfuscatedCode, regExp);
});
});
/**
* https://github.com/javascript-obfuscator/javascript-obfuscator/issues/710
*/
@@ -0,0 +1 @@
console.log(process.env.FOO);