vitaly-t / iter-ops

Basic operations on iterables
https://vitaly-t.github.io/iter-ops
MIT License
136 stars 5 forks source link

Tests error on Windows #241

Closed vitaly-t closed 2 months ago

vitaly-t commented 2 months ago

Cannot run tests, after the DEV Dependencies PR:

image

Running npm test produces the above error for me. Could be because I use Windows 11 here? I haven't tried it on Mac yet, will do a little later, if needed. It reproduces using NodeJS 18, 20 and 22.

P.S. I did remove all installed dependencies and reinstalled everything.

vitaly-t commented 2 months ago

So I have done some more testing, including on Mac, and I can now confirm that the issue is Windows-specific. I had no issues whatsoever on Mac. Specifically, it is npm run test:js that's failing, because of some c8-related issues.

Unfortunately, Windows 11 is my main rig here, so I need to figure it out. Any help is much appreciated!

@RebeccaStevens

vitaly-t commented 2 months ago

If I set the full path to the c8 module like this:

"test:js": "cross-env TSX_TSCONFIG_PATH=tsconfig.test.json NODE_OPTIONS='--import tsx' node_modules/c8/bin/c8 mocha 'test/**/*.spec.ts'"

Then I am getting this:

image

RebeccaStevens commented 2 months ago

Got a potential fix. Weird thing is that one of the tests are failing for me now on windows.

vitaly-t commented 2 months ago

That PR does work for me!!! :)

I also see some test issues, but only sometimes, that's because there are some race-condition tests that were tuned to pass under the current test framework. I will just need to fine-tune them a little now that the test framework is different, and it may effect timings for some race tests.

RebeccaStevens commented 2 months ago

Figured it out. It's a timing bug.

RebeccaStevens commented 2 months ago

Actually, maybe not a bug as such. It looks more intentional so I guess an issue with the test.

vitaly-t commented 2 months ago

Values for the test were tuned to pass under the current test framework. But since it is a race-condition test, timings change when the test framework changes, so needs to be updated to pass both on Linux and Windows. That's not something to worry about, I can update any such troubling test ;)

RebeccaStevens commented 2 months ago

Alright, I'll leave that all to you. I did make an issue though #243