From c80b323334ef6fe57d739bf8f9b4fdefa24b5ae2 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Fri, 28 Oct 2016 14:51:40 +0100 Subject: [PATCH] Revert "Add tests for command "run" (#821)" (#1537) This reverts commit 782fd8484d829b3a062b0e960433e18657018d0b. --- __tests__/commands/run.js | 87 ------------------- .../node_modules/.bin/some-binary | 3 - .../node_modules/some-binary/lib/index.js | 0 .../node_modules/some-binary/package.json | 3 - .../package.json | 3 - .../node_modules/.bin/some-binary | 3 - .../node_modules/some-binary/lib/index.js | 7 -- .../node_modules/some-binary/package.json | 3 - .../package.json | 3 - .../node_modules/.bin/some-binary | 3 - .../node_modules/some-binary/lib/index.js | 0 .../node_modules/some-binary/package.json | 3 - .../run/run-should-run-binary/package.json | 3 - .../run/run-should-run-script/package.json | 5 -- 14 files changed, 126 deletions(-) delete mode 100644 __tests__/commands/run.js delete mode 100755 __tests__/fixtures/run/run should run binary with space in path/node_modules/.bin/some-binary delete mode 100644 __tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/lib/index.js delete mode 100644 __tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/package.json delete mode 100644 __tests__/fixtures/run/run should run binary with space in path/package.json delete mode 100755 __tests__/fixtures/run/run-should-run-binary-with-args/node_modules/.bin/some-binary delete mode 100644 __tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/lib/index.js delete mode 100644 __tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/package.json delete mode 100644 __tests__/fixtures/run/run-should-run-binary-with-args/package.json delete mode 100755 __tests__/fixtures/run/run-should-run-binary/node_modules/.bin/some-binary delete mode 100644 __tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/lib/index.js delete mode 100644 __tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/package.json delete mode 100644 __tests__/fixtures/run/run-should-run-binary/package.json delete mode 100644 __tests__/fixtures/run/run-should-run-script/package.json diff --git a/__tests__/commands/run.js b/__tests__/commands/run.js deleted file mode 100644 index b3dadbdc07..0000000000 --- a/__tests__/commands/run.js +++ /dev/null @@ -1,87 +0,0 @@ -/* @flow */ - -import {run} from '../../src/cli/commands/run.js'; -import * as reporters from '../../src/reporters/index.js'; -import Config from '../../src/config.js'; - -jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000; - -const path = require('path'); - -const fixturesLoc = path.join(__dirname, '..', 'fixtures', 'run'); - -jest.mock('../../src/util/execute-lifecycle-script'); -const executeLifecycleScript = (require('../../src/util/execute-lifecycle-script').default: $FlowFixMe); - -async function runRun( - flags: Object, - args: Array, - name: string, -): Promise { - const cwd = path.join(fixturesLoc, name); - const reporter = new reporters.NoopReporter(); - const config = new Config(reporter); - await config.init({cwd}); - await run(config, reporter, flags, args); - return config; -} - -beforeEach(() => { - executeLifecycleScript.mockClear(); -}); - -it('run should run script', async (): Promise => { - const config = await runRun({}, ['some-script'], 'run-should-run-script'); - - const expectedCall = [ - 'some-script', - config, - config.cwd, - `echo success `, - ]; - - expect(executeLifecycleScript.mock.calls.length).toEqual(1); - expect(executeLifecycleScript).toBeCalledWith(...expectedCall); -}); - -it('run should run binary', async (): Promise => { - const config = await runRun({}, ['some-binary'], 'run-should-run-binary'); - - const expectedCall = [ - 'some-binary', - config, - config.cwd, - `"${path.join(config.cwd, 'node_modules/.bin/some-binary')}" `, - ]; - - expect(executeLifecycleScript.mock.calls.length).toEqual(1); - expect(executeLifecycleScript).toBeCalledWith(...expectedCall); -}); - -it('run should run binary with args', async (): Promise => { - const config = await runRun({}, ['some-binary', '--test-arg'], 'run-should-run-binary-with-args'); - - const expectedCall = [ - 'some-binary', - config, - config.cwd, - `"${path.join(config.cwd, 'node_modules/.bin/some-binary')}" --test-arg`, - ]; - - expect(executeLifecycleScript.mock.calls.length).toEqual(1); - expect(executeLifecycleScript).toBeCalledWith(...expectedCall); -}); - -it('run should run binary with space in path', async (): Promise => { - const config = await runRun({}, ['some-binary'], 'run should run binary with space in path'); - - const expectedCall = [ - 'some-binary', - config, - config.cwd, - `"${path.join(config.cwd, 'node_modules/.bin/some-binary')}" `, - ]; - - expect(executeLifecycleScript.mock.calls.length).toEqual(1); - expect(executeLifecycleScript).toBeCalledWith(...expectedCall); -}); diff --git a/__tests__/fixtures/run/run should run binary with space in path/node_modules/.bin/some-binary b/__tests__/fixtures/run/run should run binary with space in path/node_modules/.bin/some-binary deleted file mode 100755 index 83a3c57143..0000000000 --- a/__tests__/fixtures/run/run should run binary with space in path/node_modules/.bin/some-binary +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require("../some-binary"); diff --git a/__tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/lib/index.js b/__tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/lib/index.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/__tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/package.json b/__tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/package.json deleted file mode 100644 index f9e9af7364..0000000000 --- a/__tests__/fixtures/run/run should run binary with space in path/node_modules/some-binary/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "lib/index" -} diff --git a/__tests__/fixtures/run/run should run binary with space in path/package.json b/__tests__/fixtures/run/run should run binary with space in path/package.json deleted file mode 100644 index 1797133380..0000000000 --- a/__tests__/fixtures/run/run should run binary with space in path/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/.bin/some-binary b/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/.bin/some-binary deleted file mode 100755 index 83a3c57143..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/.bin/some-binary +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require("../some-binary"); diff --git a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/lib/index.js b/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/lib/index.js deleted file mode 100644 index 71ad48963a..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/lib/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* @flow */ - -const arg = '--test-arg'; - -if (process.argv.length !== 3 || process.argv[2] !== arg) { - throw new Error(`Expected a single arg "${arg}".`); -} diff --git a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/package.json b/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/package.json deleted file mode 100644 index f9e9af7364..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary-with-args/node_modules/some-binary/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "lib/index" -} diff --git a/__tests__/fixtures/run/run-should-run-binary-with-args/package.json b/__tests__/fixtures/run/run-should-run-binary-with-args/package.json deleted file mode 100644 index 1797133380..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary-with-args/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/__tests__/fixtures/run/run-should-run-binary/node_modules/.bin/some-binary b/__tests__/fixtures/run/run-should-run-binary/node_modules/.bin/some-binary deleted file mode 100755 index 83a3c57143..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary/node_modules/.bin/some-binary +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require("../some-binary"); diff --git a/__tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/lib/index.js b/__tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/lib/index.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/__tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/package.json b/__tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/package.json deleted file mode 100644 index f9e9af7364..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary/node_modules/some-binary/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main": "lib/index" -} diff --git a/__tests__/fixtures/run/run-should-run-binary/package.json b/__tests__/fixtures/run/run-should-run-binary/package.json deleted file mode 100644 index 1797133380..0000000000 --- a/__tests__/fixtures/run/run-should-run-binary/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/__tests__/fixtures/run/run-should-run-script/package.json b/__tests__/fixtures/run/run-should-run-script/package.json deleted file mode 100644 index 283b688a75..0000000000 --- a/__tests__/fixtures/run/run-should-run-script/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "scripts": { - "some-script": "echo success" - } -}