Skip to content

Conversation

@anshumanv
Copy link
Member

@anshumanv anshumanv commented Feb 23, 2020

What kind of change does this PR introduce?
Fix test arch, add more default case tests

Did you add tests for your changes?
Yay

If relevant, did you update the documentation?
NA

Summary

  • Fix arch
  • Add more tests for default flag

Does this PR introduce a breaking change?
No

Other information
Follow up of #1254

@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@anshumanv anshumanv changed the title tests(arch): fix folder structure, add more default tests - WIP tests(arch): fix folder structure, add more default tests Feb 23, 2020
@anshumanv
Copy link
Member Author

@ematipico seems good to go, can you think of any other cases that I can cover?

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

describe('output flag defaults with config', () => {
it('should use default entry if config entry file is not present', done => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this test. Here there is a config file, so why the test says "not present"?

Copy link
Member Author

Choose a reason for hiding this comment

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

The entry file specified in the config doesn't exist, so it will pick the default entry file ./index.js.

Should I improve the wording here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe .. if entry file from config is not present ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should improve the wording: "should override the [entry] property of the config file" We don't care if the file really exists or not

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, if the entry file exists, it picks up the entry specified in the config instead of the default entry but in case it doesn't then it falls back to using the default entry

Copy link
Contributor

Choose a reason for hiding this comment

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

This should NOT be the case. The point of enforcing defaults is to use OUR defaults and override everything that already exists.

Copy link
Contributor

Choose a reason for hiding this comment

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

Which means there's a bug in our strategy when we apply the defaults

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, will take a look at that too. 👍

Copy link
Member Author

@anshumanv anshumanv Feb 26, 2020

Choose a reason for hiding this comment

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

Skipping only this test for now, will enable it once I fix the above problem.

Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

They look good. I would add one more test where we use the merge argument -m.

const summary = extractSummary(stdout);
// Should use the output dir specified in the config
const outputDir = 'with-config-and-entry/binary';
// eslint-disable-next-line quotes
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed

const { stdout, stderr } = run(__dirname, ['--defaults'], false);
const summary = extractSummary(stdout);
const outputDir = 'without-config-and-entry/dist';
// eslint-disable-next-line quotes
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this line. Use the template literal (`)

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, will do 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually we're enforcing single quotes in eslint config.

@ematipico
Copy link
Contributor

And what's (arch) by the way? 😊
Usually we should specify the name of the package we are modifying. If there's no package involved, let's not put anything

@anshumanv
Copy link
Member Author

And what's (arch) by the way? 😊
Usually we should specify the name of the package we are modifying. If there's no package involved, let's not put anything

Ah, I meant to put architecture, but yes it should be removed good catch! 😄

@anshumanv anshumanv changed the title tests(arch): fix folder structure, add more default tests tests: fix folder structure, add more default tests Feb 24, 2020
ematipico
ematipico previously approved these changes Feb 26, 2020
@webpack-bot
Copy link

@anshumanv Thanks for your update.

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

@ematipico Please review the new changes.

@anshumanv
Copy link
Member Author

@ematipico, I'm getting a huge change on running watch command, these files aren't ignored in the respective .gitignore of their packages, should I modify the configs to ignore transpiled stuff too?

image

@ematipico
Copy link
Contributor

ematipico commented Feb 27, 2020

It could files of the old structure. When I was working on this refactor, I had to build manually delete all the files.

Have you tried to delete those files and build again? The project is already setup correctly, where we have the src folder and the lib folder as destination where compiled files are stored and ignored in git.

@anshumanv
Copy link
Member Author

Have you tried to delete those files and build again? The project is already setup correctly, where we have the src folder and the lib folder as destination where compiled files are stored and ignored in git.

Ah yes, not seeing them anymore, thanks @ematipico!

Anything else that I need to take care of here? Seems good from my side.

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.

3 participants