watchpack icon indicating copy to clipboard operation
watchpack copied to clipboard

Follow symlinks outside of watched folder

Open ArjhanToteck opened this issue 1 year ago • 22 comments

Solves #231 and updates the README to match. Next.js depends on this package, and this would make development much nicer (https://github.com/vercel/next.js/issues/53175).

ArjhanToteck avatar Mar 07 '24 02:03 ArjhanToteck

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: ArjhanToteck (5b221010f2e30e308423d32cb77c399a6ef4f4ea, 409ef510892e46046d75c95ea6655376a76706d9, c54fa9f73b2db6b164bd812baadcacfd4e87d046, a5f52e9ffe8d7418dd9e2f76e1d0658bfe730181, d8e305f1135c14e101cbc11b5824bd048a4d0f9d, c54bf67639ab35aa99fc561387b0266ae2965ed0, 0cd204be3996ce1e173f33664ac70820522f5fbd, 289ce5aed7c525a7e859497d019a66d686f760ce)

Looks like tests are failed, can you fix it?

alexander-akait avatar Mar 07 '24 11:03 alexander-akait

Still got a lot of remote environments failing the tests, but the machines I've tested on have been passing 100% of the unit tests reliably. I'll see if I can reproduce the failures somehow, unless it's not necessary as the required ones are passing.

ArjhanToteck avatar Mar 08 '24 03:03 ArjhanToteck

It's always the polling servers failing and I don't know why.

ArjhanToteck avatar Mar 10 '24 00:03 ArjhanToteck


         should detect a change to the direct symlink:
     Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/vsts/work/1/s/test/Watchpack.js)
      at Test.Runnable._timeoutError (/home/vsts/work/1/s/node_modules/mocha/lib/runnable.js:440:10)
      at Timeout.<anonymous> (/home/vsts/work/1/s/node_modules/mocha/lib/runnable.js:251:24)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)

  2) Watchpack
       "before each" hook:

      Uncaught AssertionError: expected Array [] to equal Array [ '/home/vsts/work/1/s/test/fixtures/link2' ] (at length, A has 0 and B has 1)
      + expected - actual

      -[]
      +[
      +  "/home/vsts/work/1/s/test/fixtures/link2"
      +]
      
      at Assertion.fail (/home/vsts/work/1/s/node_modules/should/lib/assertion.js:92:17)
      at Assertion.value (/home/vsts/work/1/s/node_modules/should/lib/assertion.js:164:19)
      at /home/vsts/work/1/s/test/Watchpack.js:1290:37
      at Watchpack.<anonymous> (/home/vsts/work/1/s/test/Watchpack.js:1261:6)
      at Watchpack.emit (events.js:314:20)
      at Watchpack._onTimeout (/home/vsts/work/1/s/lib/watchpack.js:9:22455)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)

alexander-akait avatar Mar 11 '24 11:03 alexander-akait

Will it help?

alexander-akait avatar Mar 11 '24 11:03 alexander-akait

Well, I've already seen the logs, I'm just wondering if you know whats different about the polling servers vs the normal ones, as only the polling servers are reliably failing these tests.

ArjhanToteck avatar Mar 11 '24 18:03 ArjhanToteck

I did some changes, please rebase

alexander-akait avatar Mar 12 '24 14:03 alexander-akait

Codecov Report

Attention: Patch coverage is 61.29032% with 12 lines in your changes missing coverage. Please review.

Project coverage is 90.15%. Comparing base (585ebf9) to head (d8e305f).

Files Patch % Lines
lib/DirectoryWatcher.js 61.29% 12 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #232      +/-   ##
==========================================
- Coverage   91.55%   90.15%   -1.41%     
==========================================
  Files           6        6              
  Lines        1042     1056      +14     
  Branches      250      256       +6     
==========================================
- Hits          954      952       -2     
- Misses         88      104      +16     
Flag Coverage Δ
integration 90.15% <61.29%> (-1.41%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 12 '24 15:03 codecov[bot]

Weird... Need to to tests...

alexander-akait avatar Mar 12 '24 15:03 alexander-akait

Ok so the issue is with the WATCHPACK_POLLING env variable. I guess that's what was different about those "polling" servers. I'm guessing the initial parameter in doScan is probably what's screwing things up, I'll look into fixing it.

ArjhanToteck avatar Mar 12 '24 16:03 ArjhanToteck

Feel free to feedback

alexander-akait avatar Mar 12 '24 16:03 alexander-akait

Tests are stuck again, should work this time tho

ArjhanToteck avatar Mar 16 '24 02:03 ArjhanToteck

The only thing now is that Watchpack Errors will print for a moment when a followed symlink is invalid, which is the case for a few of the tests, however this seems like it should be the correct behavior anyway, unless we don't want to warn users at all when an invalid symlink is watched.

ArjhanToteck avatar Mar 17 '24 19:03 ArjhanToteck

Ok looks like Windows is still failing when polling actually

ArjhanToteck avatar Mar 17 '24 20:03 ArjhanToteck

/cc @sokra Can you review it?

alexander-akait avatar Jul 31 '24 04:07 alexander-akait

there was a change i had made at one point that had fixed polling on the ubuntu servers, i probably shouldn't have force pushed, i just didn't want to have 1000 commits lol. Let me see if I can figure out what it had been before a code review, the one thing I can't figure out is why it doesnt work on windows. Also, there's something wrong with the macos test servers, they aren't installing or running node.js properly at all.

ArjhanToteck avatar Aug 01 '24 19:08 ArjhanToteck

Looks like two tests are broken on all OS...

alexander-akait avatar Aug 13 '24 11:08 alexander-akait