paulmillr / chokidar

Minimal and efficient cross-platform file watching library
https://paulmillr.com
MIT License
10.8k stars 574 forks source link

Failing unit tests on clean master #1306

Closed samuelneff closed 6 months ago

samuelneff commented 6 months ago

Describe the bug

I cloned the project and ran npm run test on master and received the below errors.

To Reproduce:

git clone https://github.com/paulmillr/chokidar
cd chokidar
npm i
npm run test

Expected behavior Tests should pass, right?

Additional context

Test output, trimmed. I'll attach the full results as a file. chokidar-unit-test-failure.txt

  6 failing

  1) chokidar
       fsevents (native extension)
         watch symlinks
           should survive ENOENT for missing symlinks when followSymlinks:false:
     AssertionError: expected spy to have been called exactly twice, but it was called thrice
    spy('addDir', '/Users/samuelneff/projects/chokidar/test-fixtures/49/subdir', ...) at FSWatcher.emit (node:events:517:28)
    spy('add', '/Users/samuelneff/projects/chokidar/test-fixtures/49/subdir/add.txt', ...) at FSWatcher.emit (node:events:517:28)
    spy('add', '/Users/samuelneff/projects/chokidar/test-fixtures/49/subdir/broken', ...) at FSWatcher.emit (node:events:517:28)
      at Context.<anonymous> (test.js:1200:28)

  2) chokidar
       fsevents (native extension)
         watch symlinks
           should watch symlinks within a watched dir as files when followSymlinks:false:
     AssertionError: expected spy to not have been called with arguments 'add', '/Users/samuelneff/projects/chokidar/test-fixtures/50/link/add.txt'
      at Context.<anonymous> (test.js:1220:32)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  3) chokidar
       fsevents (native extension)
         reproduction of bug in issue #1024
           should detect changes to symlink folders, even if they were deleted before:

      AssertionError: expected [ …(2) ] to deeply equal [ …(5) ]
      + expected - actual

       [
         "[ALL] addDir: test-fixtures/110/test-link"
         "[ALL] addDir: test-fixtures/110/test-link/dir"
      +  "[ALL] unlinkDir: test-fixtures/110/test-link/dir"
      +  "[ALL] addDir: test-fixtures/110/test-link/dir"
      +  "[ALL] add: test-fixtures/110/test-link/dir/file"
       ]

      at Context.<anonymous> (test.js:2182:21)

  4) chokidar
       fs.watch (non-polling)
         watch individual files
           should detect safe-edit:
     AssertionError: expected spy to have been called exactly thrice, but it was called once
    spy('change', '/Users/samuelneff/projects/chokidar/test-fixtures/138/change.txt', ...)
      at Context.<anonymous> (test.js:637:57)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  5) chokidar
       fs.watch (non-polling)
         reproduction of bug in issue #1024
           should detect changes to symlink folders, even if they were deleted before:

      AssertionError: expected [ …(2) ] to deeply equal [ …(5) ]
      + expected - actual

       [
         "[ALL] addDir: test-fixtures/223/test-link"
         "[ALL] addDir: test-fixtures/223/test-link/dir"
      +  "[ALL] unlinkDir: test-fixtures/223/test-link/dir"
      +  "[ALL] addDir: test-fixtures/223/test-link/dir"
      +  "[ALL] add: test-fixtures/223/test-link/dir/file"
       ]

      at Context.<anonymous> (test.js:2182:21)

  6) chokidar
       fs.watchFile (polling)
         reproduction of bug in issue #1024
           should detect changes to symlink folders, even if they were deleted before:

      AssertionError: expected [ …(2) ] to deeply equal [ …(5) ]
      + expected - actual

       [
         "[ALL] addDir: test-fixtures/336/test-link"
         "[ALL] addDir: test-fixtures/336/test-link/dir"
      +  "[ALL] unlinkDir: test-fixtures/336/test-link/dir"
      +  "[ALL] addDir: test-fixtures/336/test-link/dir"
      +  "[ALL] add: test-fixtures/336/test-link/dir/file"
       ]

      at Context.<anonymous> (test.js:2182:21)

I'm looking at the tests now to see if I can resolve them. Are they expected to pass on master right now?

paulmillr commented 6 months ago

no, they are expected to fail

samuelneff commented 6 months ago

Thanks for confirming.

paulmillr commented 6 months ago

1305

samuelneff commented 6 months ago

@paulmillr Are they expected to fail in that they were designed that way or in that they are not working right now? Should I look into addressing them? The failures seem a bit inconsistent--some tests fail intermittently.

paulmillr commented 6 months ago

They should not fail.

413, #923, #1006