Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cliExecuter() consumes runCLI() #1754

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/webpack-cli/__tests__/cli-executer.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
jest.mock('../lib/runner');
jest.mock('../lib/bootstrap');
jest.mock('enquirer');

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

describe('CLI Executer', () => {
let cliExecuter = null;
Expand Down Expand Up @@ -48,8 +48,8 @@ describe('CLI Executer', () => {
await cliExecuter();

// 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(runCLI.mock.calls.length).toEqual(1);
expect(runCLI.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