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

Fix Yarn 3 running mix always requires webpack-cli #3261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async function executeScript(cmd, opts, args = []) {
*/
function commandScript(cmd, opts) {
const showProgress = isTTY() && opts.progress;
const script = ['webpack'];
const script = ['webpack-cli'];

if (cmd === 'build' && showProgress) {
script.push('--progress');
Expand Down
20 changes: 10 additions & 10 deletions test/unit/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ test.before(() => {
test('it calls webpack in development mode', async t => {
const result = await mix();

result.assertScript(t, `webpack --progress --config="${configPath}"`);
result.assertScript(t, `webpack-cli --progress --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

test('it calls webpack in production mode', async t => {
const result = await mix(['--production']);

result.assertScript(t, `webpack --progress --config="${configPath}"`);
result.assertScript(t, `webpack-cli --progress --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'production' });
});

test('it calls webpack with watch mode', async t => {
const result = await mix(['watch']);

result.assertScript(t, `webpack --watch --progress --config="${configPath}"`);
result.assertScript(t, `webpack-cli --watch --progress --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

Expand All @@ -44,22 +44,22 @@ test('it calls webpack with watch mode using polling', async t => {

result.assertScript(
t,
`webpack --watch --progress --config="${configPath}" --watch-poll`
`webpack-cli --watch --progress --config="${configPath}" --watch-poll`
);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

test('it calls webpack with hot reloading', async t => {
const result = await mix(['watch', '--hot']);

result.assertScript(t, `webpack serve --hot --config="${configPath}"`);
result.assertScript(t, `webpack-cli serve --hot --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

test('it calls webpack with hot reloading using polling', async t => {
const result = await mix(['watch', '--hot', '--', '--watch-poll']);

result.assertScript(t, `webpack serve --hot --config="${configPath}" --watch-poll`);
result.assertScript(t, `webpack-cli serve --hot --config="${configPath}" --watch-poll`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

Expand All @@ -68,7 +68,7 @@ test('it calls webpack with quoted key value pair command arguments', async t =>

result.assertScript(
t,
`webpack --progress --config="${configPath}" --env foo="bar baz" foo="bar=baz"`
`webpack-cli --progress --config="${configPath}" --env foo="bar baz" foo="bar=baz"`
);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});
Expand All @@ -82,7 +82,7 @@ test.serial('it calls webpack with custom node_env', async t => {

process.env.NODE_ENV = oldEnv;

result.assertScript(t, `webpack --progress --config="${configPath}"`);
result.assertScript(t, `webpack-cli --progress --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'foobar' });
});

Expand All @@ -93,13 +93,13 @@ test.serial('it disables progress reporting when not using a terminal', async t

delete process.env.IS_TTY;

result.assertScript(t, `webpack --config="${configPath}"`);
result.assertScript(t, `webpack-cli --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});

test('it disables progress reporting when requested', async t => {
const result = await mix(['--no-progress']);

result.assertScript(t, `webpack --config="${configPath}"`);
result.assertScript(t, `webpack-cli --config="${configPath}"`);
result.assertEnv(t, { MIX_FILE: 'webpack.mix', NODE_ENV: 'development' });
});