mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Fixed SyntaxError when obfuscating a class that extends a boolean literal (#1420)
This commit is contained in:
+18
@@ -46,4 +46,22 @@ describe('BooleanLiteralTransformer', () => {
|
||||
assert.match(obfuscatedCode, regExp);
|
||||
});
|
||||
});
|
||||
|
||||
describe('boolean literal as a class super class', () => {
|
||||
const regExp: RegExp = /^class Foo extends true *{}$/;
|
||||
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/super-class-value.js');
|
||||
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(code, {
|
||||
...NO_ADDITIONAL_NODES_PRESET
|
||||
}).getObfuscatedCode();
|
||||
});
|
||||
|
||||
it('should not transform a boolean literal used as a class heritage to avoid a `SyntaxError`', () => {
|
||||
assert.match(obfuscatedCode, regExp);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
class Foo extends true {}
|
||||
Reference in New Issue
Block a user