Skip to content

Commit

Permalink
chore: cliExecuter consumes runCLI
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Aug 18, 2020
1 parent d3e2936 commit 683dbf9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/webpack-cli/__tests__/cli-executer.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jest.mock('../lib/runner');
jest.mock('../lib/bootstrap');
jest.mock('enquirer');

const runner = require('../lib/runner');
const runner = require('../lib/bootstrap');
runner.mockImplementation(() => {});

describe('CLI Executer', () => {
Expand Down Expand Up @@ -49,7 +49,7 @@ describe('CLI Executer', () => {

// ensure that the webpack runCLI is called
expect(runner.mock.calls.length).toEqual(1);
expect(runner.mock.calls[0]).toEqual([[], ['--config', 'test1', '--entry', 'test2', '--progress']]);
expect(runner.mock.calls[0][0]).toEqual(['--config', 'test1', '--entry', 'test2', '--progress']);

// check that webpack options are actually being displayed that
// the user can select from
Expand Down
10 changes: 0 additions & 10 deletions packages/webpack-cli/lib/runner.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/webpack-cli/lib/utils/cli-executer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { MultiSelect, Input } = require('enquirer');
const { cyan } = require('colorette');
const logger = require('./logger');
const cliArgs = require('./cli-flags').core;
const runner = require('../runner');
const runCLI = require('../bootstrap');

async function prompter() {
const args = [];
Expand Down Expand Up @@ -56,7 +56,7 @@ async function run() {
const args = await prompter();
process.stdout.write('\n');
logger.info('Executing CLI\n');
await runner([], args);
await runCLI(args);
} catch (err) {
logger.error(`Action Interrupted, use ${cyan('webpack-cli help')} to see possible options.`);
}
Expand Down

0 comments on commit 683dbf9

Please sign in to comment.