mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Added ability to specify the path to the input file after specifying the obfuscator options
Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/904
This commit is contained in:
@@ -32,31 +32,61 @@ describe('JavaScriptObfuscatorCLI', function (): void {
|
||||
});
|
||||
|
||||
describe('Variant #1: obfuscation of single file', () => {
|
||||
describe('`--output` option is set', () => {
|
||||
let isFileExist: boolean;
|
||||
describe('--output` option is set', () => {
|
||||
describe('Variant #1: input file path is before options', () => {
|
||||
let isFileExist: boolean;
|
||||
|
||||
before(() => {
|
||||
JavaScriptObfuscatorCLI.obfuscate([
|
||||
'node',
|
||||
'javascript-obfuscator',
|
||||
fixtureFilePath,
|
||||
'--output',
|
||||
outputFilePath,
|
||||
'--compact',
|
||||
'true',
|
||||
'--self-defending',
|
||||
'0'
|
||||
]);
|
||||
before(() => {
|
||||
JavaScriptObfuscatorCLI.obfuscate([
|
||||
'node',
|
||||
'javascript-obfuscator',
|
||||
fixtureFilePath,
|
||||
'--output',
|
||||
outputFilePath,
|
||||
'--compact',
|
||||
'true',
|
||||
'--self-defending',
|
||||
'0'
|
||||
]);
|
||||
|
||||
isFileExist = fs.existsSync(outputFilePath);
|
||||
isFileExist = fs.existsSync(outputFilePath);
|
||||
});
|
||||
|
||||
it('should create file with obfuscated code in `--output` directory', () => {
|
||||
assert.equal(isFileExist, true);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
});
|
||||
});
|
||||
|
||||
it('should create file with obfuscated code in `--output` directory', () => {
|
||||
assert.equal(isFileExist, true);
|
||||
});
|
||||
describe('Variant #2: input file path is after options', () => {
|
||||
let isFileExist: boolean;
|
||||
|
||||
after(() => {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
before(() => {
|
||||
JavaScriptObfuscatorCLI.obfuscate([
|
||||
'node',
|
||||
'javascript-obfuscator',
|
||||
'--output',
|
||||
outputFilePath,
|
||||
'--compact',
|
||||
'true',
|
||||
'--self-defending',
|
||||
'0',
|
||||
fixtureFilePath
|
||||
]);
|
||||
|
||||
isFileExist = fs.existsSync(outputFilePath);
|
||||
});
|
||||
|
||||
it('should create file with obfuscated code in `--output` directory', () => {
|
||||
assert.equal(isFileExist, true);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user