JavaScriptObfuscatorCLI.spec.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import * as child_process from 'child_process';
  2. import { JavaScriptObfuscatorCLI } from "../src/cli/JavaScriptObfuscatorCLI";
  3. let assert: any = require('chai').assert,
  4. stream: any = require("mock-utf8-stream"),
  5. mockStdin: any = require('mock-stdin');
  6. describe('JavaScriptObfuscatorCLI', () => {
  7. describe('run (): void', () => {
  8. it('should obfuscate file with JS code', function (done: MochaDone): void {
  9. let stdin: any = mockStdin.stdin(),
  10. stdout: any = new stream.MockWritableStream();
  11. this.timeout(7000);
  12. stdin.send('test/dev/test.js');
  13. stdout.startCapture();
  14. let CLI: JavaScriptObfuscatorCLI = new JavaScriptObfuscatorCLI(
  15. [
  16. 'node',
  17. 'javascript-obfuscator',
  18. '--compact',
  19. 'false',
  20. '--selfDefending',
  21. 'false'
  22. ],
  23. stdin,
  24. stdout
  25. );
  26. CLI.run();
  27. assert.equal(1, 1);
  28. });
  29. });
  30. });