Webpack-cli: [TESTS]: Write tests for the arguments we support

Created on 28 Jul 2019  路  31Comments  路  Source: webpack/webpack-cli

Is your feature request related to a problem? Please describe.
In the next branch, we're replacing old test in favor for new ones. We can still use logic from the old test suite, but we need to write new assertions. Those include:

  • [x] create
  • [x] migrate
  • [x] loader
  • [x] plugin
  • [x] info
  • [x] negated flags
  • [x] entry
  • [x] dotfolder lookup
  • [x] output
  • [x] watch
  • [x] merge
  • [x] global
  • [x] sourcemap
  • [x] help
  • [x] json
  • [x] dev
  • [x] prod
  • [x] version
  • [x] config

    Describe the solution you'd like

As listed in the previous section, these are the arguments we need to test. In addition, we need a replacement for the mode property, by reading the node env instead or by letting users pass the environment as a param to the webpack config, maybe both. I prefer that we read the node environment, because this means that we'll opt out of having to support a flag for setting mode, rather users can use the environment to set webpack mode.

Furthermore, we need to in specific, test the way we combine the cli arguments with a config specified, in such fashion that we know that we're not creating any bugs.

I'd prefer that CLI arguments outrule configuration, but I'm open for discussion on that part.

Describe alternatives you've considered
N/A

Additional context
Please comment in this issue for questions instead of reaching out to my personal accounts. This way it's public and everyone can chime in on what's happening.

CLI Feature Help Wanted High Tests enhancement inactive

All 31 comments

FYI after this issue is closed, the args that (might) cause trouble are fixed, we can tag a beta

Furthermore, we need to in specific, test the way we combine the cli arguments with a config specified, in such fashion that we know that we're not creating any bugs.

I'd prefer that CLI arguments outrule configuration, but I'm open for discussion on that part.

I think this makes sense (i.e. CLI arguments should have a higher priority in case of conflict with config).
Are there some tests I can start working on @evenstensberg?

Just pick a flag to test

@evenstensberg I started on --version flag. I am afraid that I can't understand the requirements of this use case:

webpack-cli --version (in the empty project)
Instead of printing the version of the webpack CLI, it complies with errors.

Just for info, I understand this behaviour of command as per the current codebase, but is this the expected behaviour?

Writing tests for info 鈩癸笍

Trying tests for config

I guess you can checkmark the config.
Anything left for that!?

For testing env, I think we'll add a stdout line where it says the current env for each compilation, both main and child compilations. Needs a PR to core and then drag that out to stats and tty

Writing for output

@evenstensberg can you update which flags are still required to add tests ?

The ones that are listed here are the ones missing, crossing them out as we go

Tests for Output and entry flag is done. You mark it checked if it's fine.

Will submit for info by this weekend.
Also can you explain about the dotfolder look up? Is it something like tests for ignoring them in the bundle?

Dotfolder is a convention where you have a folder .webpack which will look in parent folder for source files

command tests already exist as independent package tests.

We need to have E2E tests for those

@anikethsaha are you still working on writing test for info? If not can I work on it?

@anikethsaha are you still working on writing test for info? If not can I work on it?

go for it 馃憤

Screenshot from 2020-01-09 23-39-29

This is what I get on typing webpack info.
So in my test I should match the OS, CPU, Node and npm version, webpack and webpack-cli version. Am i right? @anikethsaha . What else can I do here?

yeah, pretty much that.
you can do tests with the plugins mentioned in the webpack config and do assertion.
and also with other dependencies.

OS, CPU

I guess it may be different for the CI version, you can consider to skip these

you can do tests with the plugins mentioned in the webpack config and do assertion.
and also with other dependencies.

Test with plugins should be done in separate test right? Which other dependencies? @anikethsaha

I keep getting this
Screenshot from 2020-01-10 16-35-46

How to continue after this?
Screenshot from 2020-01-10 16-36-09

You need to investigate that. Might be some installation error.

Which other dependencies?

I meant webpack plugins only... Installed as a dep

While installing webpack-cli error says I am installing webpack-cli in a project named webpack-cli. @anikethsaha

You don't have to install webpack cli for working in this project locally.
Read the contribution guide. All steps are mentioned there.
In order to tests and use the local version you need to link it....

I can test other cmds like help, json etc. Project has been correctly installed. Just run(__dirname, [info]) gives the install msg. So in place of info what else can I run? @anikethsaha @rishabh3112 . What do you get on your local when you console.log(stdout) from run(__dirname, [info])?

Writing for create

I have Added Tests for some Negated flags

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

I think we have covered everything, closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sumukhah picture sumukhah  路  3Comments

anyulled picture anyulled  路  4Comments

logo749 picture logo749  路  4Comments

Pomax picture Pomax  路  3Comments

heyalbert picture heyalbert  路  3Comments