Sync with master

This commit is contained in:
sanex
2021-07-24 02:46:18 +03:00
7 changed files with 50 additions and 10 deletions
@@ -968,6 +968,35 @@ describe('JavaScriptObfuscator', () => {
});
});
describe('Private identifiers support', () => {
const regExp: RegExp = new RegExp(
'class Foo *{ *' +
'#bar *= *0x1; *' +
'\\[\'method\'] *\\(\\) *{ *' +
'this\.#bar *= *0x2;' +
'} *' +
'}'
);
let obfuscatedCode: string;
beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/private-identifier.js');
obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET,
renameProperties: true
}
).getObfuscatedCode();
});
it('should support private identifiers', () => {
assert.match(obfuscatedCode, regExp);
});
});
describe('mangled identifier names generator', () => {
const regExp: RegExp = /var c *= *0x1/;
@@ -0,0 +1,7 @@
class Foo {
#bar = 1;
method() {
this.#bar = 2;
}
}