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

tests: add more cases in ZeroConfigGroup test #1682

Merged
merged 1 commit into from
Jul 17, 2020
Merged
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
28 changes: 28 additions & 0 deletions packages/webpack-cli/__tests__/ZeroConfigGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('ZeroConfigGroup', function () {
const result = group.run();
expect(result.options.mode).toEqual('development');
});

it('should load the prod zero config', () => {
const group = new ZeroConfigGroup([
{
Expand All @@ -21,6 +22,7 @@ describe('ZeroConfigGroup', function () {
const result = group.run();
expect(result.options.mode).toEqual('production');
});

it('should handle the mode option [production]', () => {
const group = new ZeroConfigGroup([
{
Expand Down Expand Up @@ -58,4 +60,30 @@ describe('ZeroConfigGroup', function () {
expect(result.options).toMatchObject({ mode: 'none' });
expect(result.options.mode).toEqual('none');
});

it('should use mode when mode and dev both are provided', () => {
const group = new ZeroConfigGroup([
{
mode: 'production',
dev: true,
},
]);

const result = group.run();
// ensure no other properties are added
expect(result.options).toMatchObject({ mode: 'production' });
});

it('should use mode when mode and prod both are provided', () => {
const group = new ZeroConfigGroup([
{
mode: 'development',
prod: true,
},
]);

const result = group.run();
// ensure no other properties are added
expect(result.options).toMatchObject({ mode: 'development' });
});
});