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

Fix flaky CLI test #15932

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions .yarn/patches/chokidar-npm-3.5.3-c5f9b0a56a.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/index.js b/index.js
index ed4b6d5b6cbabee76c879c6eedcc7bf6ba46d38d..8752893ca4986cf05103a46c438223b7ee4e1907 100644
--- a/index.js
+++ b/index.js
@@ -441,7 +441,7 @@ add(paths_, _origAdd, _internal) {

if (this.options.useFsEvents && this._fsEventsHandler) {
if (!this._readyCount) this._readyCount = paths.length;
- if (this.options.persistent) this._readyCount *= 2;
+ if (this.options.persistent) this._readyCount += paths.length;
Copy link
Contributor Author

@JLHwung JLHwung Sep 5, 2023

Choose a reason for hiding this comment

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

It seems like an upstream bug to me, because
watcher.add(["a.js"]); watcher.add(["b.js"]); watcher.add(["c.js"]) should yield the same _readyCount (currently 8) as calling watcher.add(["a.js", "b.js", "c.js"]) (currently 6). However I am not familiar with the chokidar codebase at all, so I create an ad-hoc patch here and see if it is sufficient to save that test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The upstream PR: paulmillr/chokidar#1288

paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path));
} else {
if (!this._readyCount) this._readyCount = 0;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
"@types/babel__traverse": "link:./nope",
"@babel/parser/@babel/types": "workspace:*",
"@babel/plugin-syntax-unicode-sets-regex/@babel/helper-create-regexp-features-plugin": "workspace:*",
"babel-plugin-polyfill-corejs2/@babel/compat-data": "workspace:*"
"babel-plugin-polyfill-corejs2/@babel/compat-data": "workspace:*",
"chokidar@^3.4.0": "patch:chokidar@npm%3A3.5.3#./.yarn/patches/chokidar-npm-3.5.3-c5f9b0a56a.patch",
"chokidar@^3.4.1": "patch:chokidar@npm%3A3.5.3#./.yarn/patches/chokidar-npm-3.5.3-c5f9b0a56a.patch"
},
"engines": {
"yarn": ">=1.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"args": ["*/src", "--out-dir", "../lib", "--relative", "--watch"],
"noBabelrc": true,
"noDefaultPlugins": true,
"minNodeVersion": 10,
"flaky": true
"minNodeVersion": 10
}
25 changes: 22 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7367,6 +7367,25 @@ __metadata:
languageName: node
linkType: hard

"chokidar@npm:3.5.3, chokidar@npm:^3.4.0":
version: 3.5.3
resolution: "chokidar@npm:3.5.3"
dependencies:
anymatch: ~3.1.2
braces: ~3.0.2
fsevents: ~2.3.2
glob-parent: ~5.1.2
is-binary-path: ~2.1.0
is-glob: ~4.0.1
normalize-path: ~3.0.0
readdirp: ~3.6.0
dependenciesMeta:
fsevents:
optional: true
checksum: b49fcde40176ba007ff361b198a2d35df60d9bb2a5aab228279eb810feae9294a6b4649ab15981304447afe1e6ffbf4788ad5db77235dc770ab777c6e771980c
languageName: node
linkType: hard

"chokidar@npm:^2.1.8":
version: 2.1.8
resolution: "chokidar@npm:2.1.8"
Expand All @@ -7390,9 +7409,9 @@ __metadata:
languageName: node
linkType: hard

"chokidar@npm:^3.4.0, chokidar@npm:^3.4.1":
"chokidar@patch:chokidar@npm%3A3.5.3#./.yarn/patches/chokidar-npm-3.5.3-c5f9b0a56a.patch::locator=babel%40workspace%3A.":
version: 3.5.3
resolution: "chokidar@npm:3.5.3"
resolution: "chokidar@patch:chokidar@npm%3A3.5.3#./.yarn/patches/chokidar-npm-3.5.3-c5f9b0a56a.patch::version=3.5.3&hash=c922bc&locator=babel%40workspace%3A."
dependencies:
anymatch: ~3.1.2
braces: ~3.0.2
Expand All @@ -7405,7 +7424,7 @@ __metadata:
dependenciesMeta:
fsevents:
optional: true
checksum: b49fcde40176ba007ff361b198a2d35df60d9bb2a5aab228279eb810feae9294a6b4649ab15981304447afe1e6ffbf4788ad5db77235dc770ab777c6e771980c
checksum: 47ebddc0207bf7525c2a29d73ce4e27b2fd9187d8d63d34cbe20d447f0a7bbd7508d13d5901803b75fc2e84b3b162458b0863cc14a7af2fe5ad758dba791edf4
languageName: node
linkType: hard

Expand Down