mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import * as fs from 'fs';
|
|
|
|
import { JavaScriptObfuscator } from "../src/JavaScriptObfuscator";
|
|
|
|
let assert: any = require('chai').assert;
|
|
|
|
describe('JavaScriptObfuscatorCLI', () => {
|
|
let fixturesDirName: string = 'test/fixtures',
|
|
tmpDirName: string = 'test/tmp',
|
|
fixtureFileName: string = 'sample.js',
|
|
fixtureFilePath: string = `${fixturesDirName}/${fixtureFileName}`,
|
|
outputFileName: string = 'sample-obfuscated.js',
|
|
outputFilePath: string = `${tmpDirName}/${outputFileName}`;
|
|
|
|
describe('run (): void', () => {
|
|
beforeEach(() => {
|
|
JavaScriptObfuscator.runCLI([
|
|
'node',
|
|
'javascript-obfuscator',
|
|
fixtureFilePath,
|
|
'--output',
|
|
outputFilePath,
|
|
'--compact',
|
|
'false',
|
|
'--selfDefending',
|
|
'false'
|
|
]);
|
|
});
|
|
|
|
it('should obfuscate file with JS code', () => {
|
|
assert.equal(1, 1);
|
|
});
|
|
|
|
afterEach(() => {
|
|
fs.unlinkSync(outputFilePath);
|
|
fs.rmdirSync(tmpDirName);
|
|
});
|
|
});
|
|
});
|