Преглед на файлове

`commander` version update

sanex3339 преди 5 години
родител
ревизия
8aa02363fd
променени са 5 файла, в които са добавени 53 реда и са изтрити 7 реда
  1. 0 0
      dist/index.cli.js
  2. 0 0
      dist/index.js
  3. 1 1
      package.json
  4. 48 2
      test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts
  5. 4 4
      yarn.lock

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/index.cli.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/index.js


+ 1 - 1
package.json

@@ -28,7 +28,7 @@
     "chalk": "3.0.0",
     "chance": "1.1.4",
     "class-validator": "0.11.0",
-    "commander": "4.1.1",
+    "commander": "5.0.0",
     "escodegen": "1.14.1",
     "eslint-scope": "5.0.0",
     "estraverse": "4.3.0",

+ 48 - 2
test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts

@@ -713,14 +713,59 @@ describe('JavaScriptObfuscatorCLI', function (): void {
 
         describe('help output', () => {
             let callback: sinon.SinonSpy<any, void>,
-                stdoutWriteMock: StdoutWriteMock;
+                stdoutWriteMock: StdoutWriteMock,
+                stubExit: sinon.SinonStub;
 
             beforeEach(() => {
+                stubExit = sinon.stub(process, 'exit');
                 callback = sinon.spy(console, 'log');
                 stdoutWriteMock = new StdoutWriteMock(process.stdout.write);
             });
 
-            describe('`--help` option is set', () => {
+            describe('`--help` option is set without any additional parameters', () => {
+                let isConsoleLogCalled: boolean;
+
+                beforeEach(() => {
+                    stdoutWriteMock.mute();
+
+                    JavaScriptObfuscatorCLI.obfuscate([
+                        'node',
+                        'javascript-obfuscator',
+                        '--help'
+                    ]);
+
+                    stdoutWriteMock.restore();
+                    isConsoleLogCalled = callback.called;
+                });
+
+                it('should print `console.log` help', () => {
+                    assert.equal(isConsoleLogCalled, true);
+                });
+            });
+
+            describe('`--help` option is set before file path', () => {
+                let isConsoleLogCalled: boolean;
+
+                beforeEach(() => {
+                    stdoutWriteMock.mute();
+
+                    JavaScriptObfuscatorCLI.obfuscate([
+                        'node',
+                        'javascript-obfuscator',
+                        '--help',
+                        fixtureFilePath
+                    ]);
+
+                    stdoutWriteMock.restore();
+                    isConsoleLogCalled = callback.called;
+                });
+
+                it('should print `console.log` help', () => {
+                    assert.equal(isConsoleLogCalled, true);
+                });
+            });
+
+            describe('`--help` option is set after file path', () => {
                 let isConsoleLogCalled: boolean;
 
                 beforeEach(() => {
@@ -763,6 +808,7 @@ describe('JavaScriptObfuscatorCLI', function (): void {
             });
 
             afterEach(() => {
+                stubExit.restore();
                 callback.restore();
             });
         });

+ 4 - 4
yarn.lock

@@ -1285,10 +1285,10 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
   dependencies:
     delayed-stream "~1.0.0"
 
-commander@4.1.1:
-  version "4.1.1"
-  resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
-  integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
+commander@5.0.0:
+  version "5.0.0"
+  resolved "https://registry.yarnpkg.com/commander/-/commander-5.0.0.tgz#dbf1909b49e5044f8fdaf0adc809f0c0722bdfd0"
+  integrity sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ==
 
 commander@^2.20.0:
   version "2.20.3"

Някои файлове не бяха показани, защото твърде много файлове са промени