chokidar icon indicating copy to clipboard operation
chokidar copied to clipboard

Test failures on macOS

Open bpasero opened this issue 4 years ago • 4 comments

Describe the bug

I am seeing test failures on macOS running npm run mocha

Versions (please complete the following information):

  • Chokidar version 3.4.0
  • Node version 12.13.1
  • OS version: macOS 10.14

To Reproduce:

npm run mocha

Expected behavior No test failures.

Additional context Tests run green for me on version 3.2.3 and I am worried to update given these errors.

319 passing (2m)
  18 pending
  3 failing

  1) chokidar
       fsevents (native extension)
         watch individual files
           should detect safe-edit:
     AssertionError: expected spy to have been called exactly thrice, but it was called twice
    spy(change, /Users/bpasero/Desktop/chokidar/test-fixtures/24/change.txt)
    spy(change, /Users/bpasero/Desktop/chokidar/test-fixtures/24/change.txt)
      at Context.<anonymous> (test.js:620:57)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)

  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/bpasero/Desktop/chokidar/test-fixtures/48/link/add.txt
      at Context.<anonymous> (test.js:1186:32)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)

  3) 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/bpasero/Desktop/chokidar/test-fixtures/131/change.txt, [Stats] {
  atime: Sun May 03 2020 10:52:53 GMT+0200 (Central European Summer Time),
  atimeMs: 1588495973663.2852,
  birthtime: Sun May 03 2020 10:52:53 GMT+0200 (Central European Summer Time),
  birthtimeMs: 1588495973663.2852,
  blksize: 4096,
  blocks: 8,
  ctime: Sun May 03 2020 10:52:53 GMT+0200 (Central European Summer Time),
  ctimeMs: 1588495973664.2354,
  dev: 16777221,
  gid: 20,
  ino: 43422998,
  mode: 33188,
  mtime: Sun May 03 2020 10:52:53 GMT+0200 (Central European Summer Time),
  mtimeMs: 1588495973663.6724,
  nlink: 1,
  rdev: 0,
  size: 13,
  uid: 501
})
      at Context.<anonymous> (test.js:620:57)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)

bpasero avatar May 03 '20 08:05 bpasero

Hey Benjamin. This started to happen because we've added symlink support to readdirp. Before, symlinked directories were not followed - only files. https://github.com/paulmillr/readdirp/pull/151

I've been thinking about the test. And it doesn't seem to be that big of a deal. As you've correcly mentioned, chokidar always supported symlinked directories. I've looked into various projects including vscode - doesn't seem like many people are using followSymlinks: false. So we just need to adjust tests, but that's not exactly simple.

paulmillr avatar May 03 '20 12:05 paulmillr

@paulmillr

I've looked into various projects including vscode - doesn't seem like many people are using followSymlinks: false

So these test failures only impact if you configure followSymlinks: false? VSCode is not doing so, we always set followSymlinks: true

This started to happen because we've added symlink support to readdirp. Before, symlinked directories were not followed - only files. paulmillr/readdirp#151

I already asked in https://github.com/paulmillr/readdirp/issues/150#issuecomment-623074404, it is not clear to me what impact the change in readdirp has for symlinked directories given that chokidar already followed them.

bpasero avatar May 04 '20 06:05 bpasero

Yes, i've made a call to release 3.4 with the broken test because vscode and other projects aren't using the functionality. So, all good.

The link handling change requires adjustments related to tracking symlinks in chokidar to make it work correctly with followSymlinks: false. Not a simple task. For most folks nothing changes so there's nothing to worry.

Regarding "should detect safe-edit" test failure - this should not happen. Does it still happen consistently?

paulmillr avatar May 04 '20 14:05 paulmillr

Yes, i've made a call to release 3.4 with the broken test because vscode and other projects aren't using the functionality. So, all good.

👍

The link handling change requires adjustments related to tracking symlinks in chokidar to make it work correctly with followSymlinks: false. Not a simple task. For most folks nothing changes so there's nothing to worry.

👍

Regarding "should detect safe-edit" test failure - this should not happen. Does it still happen consistently?

Yeah seeing it fail more than once when I start the tests. I always run npm run mocha (all tests).

bpasero avatar May 04 '20 15:05 bpasero