Skip to content

tests: add test for zero config#1418

Merged
alexander-akait merged 7 commits into
webpack:nextfrom
anshumanv:0cjs/tests
Apr 7, 2020
Merged

tests: add test for zero config#1418
alexander-akait merged 7 commits into
webpack:nextfrom
anshumanv:0cjs/tests

Conversation

@anshumanv

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

tests

Did you add tests for your changes?
Yes

If relevant, did you update the documentation?
NA

Summary

  • Add some test cases for zero-config.

Does this PR introduce a breaking change?
No

Other information

  • Any suggestion on how to strengthen are appreciated.

@anshumanv
anshumanv requested a review from a team as a code owner April 4, 2020 07:50
Comment thread test/zero-config/with-config/zero-config-entry.test.js Outdated
Comment thread test/zero-config/entry-present/zero-config.test.js Outdated
Comment thread test/zero-config/with-config/zero-config-entry.test.js Outdated

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple extra test, anyway good job!

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add test when entry point exists, but webpack.config.js no?

// Should be able to find the entry file
expect(stdout).toContain('./src/index.js');
// Should output at the default output dir and filename
expect(stdout).toContain('Entrypoint main = main.js');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have it, only entry present and config absent. @evilebottnawi

alexander-akait
alexander-akait previously approved these changes Apr 6, 2020

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work

@alexander-akait

Copy link
Copy Markdown
Member

Can you provide here structure what we generate on init by default?

@anshumanv

Copy link
Copy Markdown
Contributor Author

on init? as in?

@anshumanv

Copy link
Copy Markdown
Contributor Author

The default config you mean?

@alexander-akait

Copy link
Copy Markdown
Member

@anshumanv init, we need investigate unnecessary stuff

@anshumanv

Copy link
Copy Markdown
Contributor Author

@anshumanv init, we need investigate unnecessary stuff

init tests are here - #1419

@alexander-akait

alexander-akait commented Apr 6, 2020

Copy link
Copy Markdown
Member

@anshumanv Feel free to merge after CI was green

@anshumanv

Copy link
Copy Markdown
Contributor Author

Cool, need another review then I'll merge once green. 👍

@anshumanv
anshumanv requested a review from rishabh3112 April 6, 2020 11:47

@rishabh3112 rishabh3112 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just one suggestion.

const { run } = require('../../utils/test-utils');

describe('Zero Config tests', () => {
it('runs when no config is supplied but entry is present', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also test for existence of bundle output file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can def do that, thinking if this would be the right scope for it as output file check is something which is config/flag agnostic. wdyt? Since we're not checking for it anywhere else, should be also checked for it in all other tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we can just check the test util since it's used everywhere, will add tests for the run fn that we use in all tests separately. Would make more sense to check file existence there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case we should test it either way imo. Because the test is for checking whether without config we are bundling or not.

Tests for run as well in a different PR would be great :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we can just check the test util since it's used everywhere, will add tests for the run fn that we use in all tests separately. Would make more sense to check file existence there.

We're consuming the run fn for couple of test cases where bundle output is not generated, say the migrate command. It should be taken into account while writing the respective tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fair, added. 👍

@webpack-bot

Copy link
Copy Markdown

@anshumanv Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@rishabh3112 Please review the new changes.

@alexander-akait
alexander-akait merged commit 848d80e into webpack:next Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants