fabiospampinato / watcher

The file system watcher that strives for perfection, with no native dependencies and optional rename detection support.
MIT License
115 stars 15 forks source link

Tests failing (Linux and macOS) #17

Open aral opened 1 year ago

aral commented 1 year ago
  1. Cloned the repository
  2. Run:

    npm install
    npm run clean
    npm run compile
    npm run test

Errors

Linux

(Tested on Fedora Silverblue 37 using Node.js 19.3.0 and 18.12.1)

> watcher@2.2.0 test
> fava '**/test/index.js'

✖ Watcher › watching files › should watch new files inside an initially empty deep directory
╭ Error ─╮
watchers number
──
/var/home/aral/Projects/other/watcher/test/index.js:176
╰─ t.context.hasWatchObjects ( 0, 0, 3 );
╰─╯
✖ Watcher › watching files › should watch (touched) new files inside an initially empty deep directory
╭ Error ──╮
watchers number
───
/var/home/aral/Projects/other/watcher/test/index.js:189
╰─ t.context.hasWatchObjects ( 0, 0, 3 );

(Hangs at end.)

macOS

(Tested on macOS Monterey with Node.js 19.3.0.)

> watcher@2.2.0 test
> fava '**/test/index.js'

✖ Watcher › watching directories › should watch new directories inside a new deep directory (1100ms)
╭ Error ──╮
Expected "0" to be exactly "3"
───
/Users/aral/sandbox/watcher/test/index.js:364
╰─ t.context.deepEqualUnorderedChanges ( [newdir0, newdir1, newdir2] );
╰──╯

ℹ File: index.js
ℹ Tests: 183 passed, 1 failed

(Gets further to display test totals but also hangs; doesn’t exit.)

fabiospampinato commented 1 year ago

After a while I got this on macOS (Node v18.12.0):

~/Code/fabiospampinato/watcher ❯ npm run test             

> watcher@2.2.0 test
> fava '**/test/index.js'

(node:76177) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
ℹ File: index.js
ℹ Tests: 184 passed, 0 failed

These tests are a bit finicky, you should try running them again under macOS. Under linux last time I checked if I remember correctly some tests don't pass because they don't account for some Linux-specific differences, but ultimately the library seems to work correctly there too. I should try to make these less finicky, and to make all of them pass under linux. PRs welcome I guess.

benmccann commented 4 months ago

I sent https://github.com/fabiospampinato/watcher/pull/40 to fix some of the tests

It also looks to me like the failure below started in version 2.2.2:

✖ Watcher › file events (with renames) › should detect a single "change" when removing a file and creating it (2004ms) ╭ Error >────────────────────────────────────────────────────────────────────────────────>─────────────────────────────────────────────────────────╮ Expected "" to be deeply equal to "change" ────────────────────────────────────────────────────────────────────────────────>────────────────────────────────────────────────────────────────── test/index.js:1122 ╰─ t.context.deepEqualResults ( ['change'], [file] );