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

exclude /node_modules/ from _watch by default #1794

Merged
merged 4 commits into from
Apr 29, 2019

Conversation

EslamHiko
Copy link
Member

@EslamHiko EslamHiko commented Apr 12, 2019

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

I'm not sure how exactly to write a test for this except testing it manually.

Motivation / Use-Case

fixes #1781

Breaking Changes

No

Additional Info

I had a very strange behavior when I try to change the value of this.watchOptions when I do

this.watchOptions = options.watchOptions || {};
this.watchOptions.ignored = this.watchOptions.ignored || /node_modules/;

chokidar always reads the ignored option as undefined even if i try to edit the value of this.watchOptions just right before setting it's options.

this.watchOptions.ignored = this.watchOptions.ignored || /node_modules/;

const options = {
      ignoreInitial: true,
      persistent: true,
      followSymlinks: false,
      atomic: false,
      alwaysStat: true,
      ignorePermissionErrors: true,
      ignored: this.watchOptions.ignored,
      usePolling,
      interval,
    };

it works only with me the way I did the change
So what's wrong about it? and if I can write a test for this how would I test it.

lib/Server.js Outdated
}
// ignoring node_modules folder by default
options.watchOptions.ignored =
options.watchOptions.ignored || /node_modules/;
Copy link
Member

Choose a reason for hiding this comment

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

I think we need use here [/node_modules/]. also need add tests to avoid future regressions

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Thanks for PR, you can find example of tests in test/ContentBase.js

@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

Merging #1794 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1794      +/-   ##
==========================================
+ Coverage   89.14%   89.19%   +0.05%     
==========================================
  Files           9        9              
  Lines         608      611       +3     
  Branches      185      186       +1     
==========================================
+ Hits          542      545       +3     
  Misses         54       54              
  Partials       12       12
Impacted Files Coverage Δ
lib/Server.js 85.32% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f3b8c9...4849c14. Read the comment docs.

@EslamHiko
Copy link
Member Author

@evilebottnawi Done

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

/cc @hiroppy

@hiroppy
Copy link
Member

hiroppy commented Apr 29, 2019

plz check Node6

FAIL test/cli.test.js (25.375s)
  ● CLI › should use different random port when multiple instances are started on different processes
    expect(received).toBe(expected) // Object.is equality
    Expected: true
    Received: false
      175 |       runtime.cp2.done = true;
      176 |       if (runtime.cp.done) {
    > 177 |         expect(runtime.cp.port !== runtime.cp2.port).toBe(true);
          |                                                      ^
      178 |         done();
      179 |       }
      180 |     });
      at ChildProcess.toBe (test/cli.test.js:177:54)
      at ChildProcess.cp.emit (node_modules/cross-spawn/lib/enoent.js:34:25)

I think this error is unrelated to this PR...

CI is green

Copy link
Member

@hiroppy hiroppy left a comment

Choose a reason for hiding this comment

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

thanks

@hiroppy hiroppy merged commit 4c52153 into webpack:master Apr 29, 2019
@EslamHiko
Copy link
Member Author

@hiroppy You're Welcome 😄

@hiroppy
Copy link
Member

hiroppy commented May 29, 2019

Users using html-webpack-plguin are many and this change causes many impacts.
FYI: #1934

/cc @evilebottnawi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exclude node_modules by default in _watch for content base
4 participants