|  | @@ -1,5 +1,7 @@
 | 
	
		
			
				|  |  |  import { assert } from 'chai';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import { StringArrayEncoding } from '../../../../../src/enums/node-transformers/string-array-transformers/StringArrayEncoding';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import { readFileAsString } from '../../../../helpers/readFileAsString';
 | 
	
	
		
			
				|  | @@ -166,7 +168,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |      describe('Variant #10: string with emoji', () => {
 | 
	
		
			
				|  |  |          describe('Variant #1: single emoji', () => {
 | 
	
		
			
				|  |  |              it('should correctly split string with emoji', () => {
 | 
	
		
			
				|  |  | -                const regExp: RegExp = /^'a' *\+ *'b' *\+ *'\ud83d' *\+ *'\udc4b' *\+ *'\ud83c' *\+ *'\udffc' *\+ *'c' *\+ *'d';$/;
 | 
	
		
			
				|  |  | +                const regExp: RegExp = /^'a' *\+ *'b' *\+ *'👋🏼' *\+ *'c' *\+ *'d';$/;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  const code: string = readFileAsString(__dirname + '/fixtures/string-with-emoji-1.js');
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -204,7 +206,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          describe('Variant #2: multiple emoji', () => {
 | 
	
		
			
				|  |  |              it('should correctly split string with emoji', () => {
 | 
	
		
			
				|  |  | -                const regExp: RegExp = /^'a' *\+ *'b' *\+ *'\ud83d' *\+ *'\ude34' *\+ *'\ud83d' *\+ *'\ude04' *\+ *'c' *\+ *'d';$/;
 | 
	
		
			
				|  |  | +                const regExp: RegExp = /^'a' *\+ *'b' *\+ *'😴' *\+ *'😄' *\+ *'c' *\+ *'d';$/;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  const code: string = readFileAsString(__dirname + '/fixtures/string-with-emoji-2.js');
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -239,9 +241,79 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |                  assert.equal(resultString, expectedResultString);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        describe('Variant #3: correct split emoji', () => {
 | 
	
		
			
				|  |  | +            it('should correctly split string with emoji', () => {
 | 
	
		
			
				|  |  | +                const regExp: RegExp = /^'ab👋🏼' *\+ *'cd';$/;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                const code: string = readFileAsString(__dirname + '/fixtures/string-with-emoji-1.js');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                obfuscatedCode = JavaScriptObfuscator.obfuscate(
 | 
	
		
			
				|  |  | +                    code,
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        ...NO_ADDITIONAL_NODES_PRESET,
 | 
	
		
			
				|  |  | +                        splitStrings: true,
 | 
	
		
			
				|  |  | +                        splitStringsChunkLength: 3
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                ).getObfuscatedCode();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                assert.match(obfuscatedCode,  regExp);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            it('should correctly evaluate splitted string with emoji', () => {
 | 
	
		
			
				|  |  | +                const expectedResultString: string = 'ab👋🏼cd';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                const code: string = readFileAsString(__dirname + '/fixtures/string-with-emoji-1.js');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                obfuscatedCode = JavaScriptObfuscator.obfuscate(
 | 
	
		
			
				|  |  | +                    code,
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        ...NO_ADDITIONAL_NODES_PRESET,
 | 
	
		
			
				|  |  | +                        splitStrings: true,
 | 
	
		
			
				|  |  | +                        splitStringsChunkLength: 3
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                ).getObfuscatedCode();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                const resultString: string = eval(obfuscatedCode);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                assert.equal(resultString, expectedResultString);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    describe('Variant #11: Integration with `stringArrayEncoding` option', () => {
 | 
	
		
			
				|  |  | +        describe('Variant #1: base64 encoding', () => {
 | 
	
		
			
				|  |  | +            describe('Variant #1: string with emoji', () => {
 | 
	
		
			
				|  |  | +                describe('Variant #1: prevent URI-malformed error', () => {
 | 
	
		
			
				|  |  | +                    it('should correctly evaluate splitted string with emoji', () => {
 | 
	
		
			
				|  |  | +                        const expectedResultString: string = 'ab👋🏼cd';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        const code: string = readFileAsString(__dirname + '/fixtures/string-with-emoji-1.js');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        obfuscatedCode = JavaScriptObfuscator.obfuscate(
 | 
	
		
			
				|  |  | +                            code,
 | 
	
		
			
				|  |  | +                            {
 | 
	
		
			
				|  |  | +                                ...NO_ADDITIONAL_NODES_PRESET,
 | 
	
		
			
				|  |  | +                                splitStrings: true,
 | 
	
		
			
				|  |  | +                                splitStringsChunkLength: 3,
 | 
	
		
			
				|  |  | +                                stringArray: true,
 | 
	
		
			
				|  |  | +                                stringArrayThreshold: 1,
 | 
	
		
			
				|  |  | +                                stringArrayEncoding: [
 | 
	
		
			
				|  |  | +                                    StringArrayEncoding.Base64
 | 
	
		
			
				|  |  | +                                ]
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        ).getObfuscatedCode();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        const resultString: string = eval(obfuscatedCode);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        assert.equal(resultString, expectedResultString);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #11: Integration with `transformObjectKeys` option', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #12: Integration with `transformObjectKeys` option', () => {
 | 
	
		
			
				|  |  |          it('should correctly transform string when `transformObjectKeys` option is enabled', () => {
 | 
	
		
			
				|  |  |              const regExp: RegExp = new RegExp(`` +
 | 
	
		
			
				|  |  |                  `var _0x[a-f0-9]{4,6} *= *{};` +
 | 
	
	
		
			
				|  | @@ -267,7 +339,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #12: Integration with `reservedStrings` option', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #13: Integration with `reservedStrings` option', () => {
 | 
	
		
			
				|  |  |          it('should correctly ignore strings from `reservedStrings` option', () => {
 | 
	
		
			
				|  |  |              const code: string = readFileAsString(__dirname + '/fixtures/ignore-reserved-strings.js');
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -288,7 +360,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #13: Large string', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #14: Large string', () => {
 | 
	
		
			
				|  |  |          it('Should does not throw `Maximum call stack size exceeded` error on a large string', () => {
 | 
	
		
			
				|  |  |              const code: string = `var foo = '${'a'.repeat(10000)}';`;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -308,7 +380,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #14: import declaration source literal', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #15: import declaration source literal', () => {
 | 
	
		
			
				|  |  |          const importDeclarationRegExp: RegExp = /import *{ *bar *} *from *'foo';/;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          let obfuscatedCode: string;
 | 
	
	
		
			
				|  | @@ -331,7 +403,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #15: export all declaration source literal', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #16: export all declaration source literal', () => {
 | 
	
		
			
				|  |  |          const exportAllDeclarationRegExp: RegExp = /export *\* *from *'foo';/;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          let obfuscatedCode: string;
 | 
	
	
		
			
				|  | @@ -354,7 +426,7 @@ describe('SplitStringTransformer', () => {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    describe('Variant #16: export named declaration source literal', () => {
 | 
	
		
			
				|  |  | +    describe('Variant #17: export named declaration source literal', () => {
 | 
	
		
			
				|  |  |          const exportNamedDeclarationRegExp: RegExp = /export *{ *bar *} *from *'foo';/;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          let obfuscatedCode: string;
 |