watcher icon indicating copy to clipboard operation
watcher copied to clipboard

Tests failing (Linux and macOS)

Open aral opened this issue 2 years ago • 2 comments

  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)

> [email protected] 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.)

> [email protected] 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.)

aral avatar Dec 27 '22 18:12 aral

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

~/Code/fabiospampinato/watcher ❯ npm run test             

> [email protected] 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.

fabiospampinato avatar Dec 27 '22 19:12 fabiospampinato

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] );

benmccann avatar May 16 '24 05:05 benmccann