tests are failing on windows and LTS node v12.19.0
See original GitHub issueI recently got a windows machine and the tests are failing when executed.
FAIL src/tests/server.ts
● Connect › should not close the socket after the `connectionInitWaitTimeout` has passed but the callback is still resolving
expect.assertions(2)
Expected two assertions to be called but received one assertion call.
268 |
269 | it('should not close the socket after the `connectionInitWaitTimeout` has passed but the callback is still resolving', async () => {
> 270 | expect.assertions(2);
| ^
271 |
272 | await makeServer({
273 | connectionInitWaitTimeout: 10,
at Object.<anonymous> (src/tests/server.ts:270:12)
● Connect › should close the socket if an additional `ConnectionInit` message is received while one is pending
expect.assertions(3)
Expected three assertions to be called but received four assertion calls.
298 |
299 | it('should close the socket if an additional `ConnectionInit` message is received while one is pending', async () => {
> 300 | expect.assertions(3);
| ^
301 |
302 | await makeServer({
303 | connectionInitWaitTimeout: 10,
at Object.<anonymous> (src/tests/server.ts:300:12)
FAIL src/tests/client.ts
● "concurrency" › should dispatch and receive messages even if one subscriber disposes while another one subscribes
expect(jest.fn()).toBeCalled()
Expected number of calls: >= 1
Received number of calls: 0
399 | expect(nextFnForHappy).not.toBeCalled();
400 | expect(completeFnForHappy).toBeCalled();
> 401 | expect(nextFnForBananas).toBeCalled();
| ^
402 | });
403 | });
404 |
at Object.<anonymous> (src/tests/client.ts:401:30)
● lazy › should connect immediately when mode is disabled
expect(received).toBe(expected) // Object.is equality
Expected: 1
Received: 2
411 | await wait(10);
412 |
> 413 | expect(server.webSocketServer.clients.size).toBe(1);
| ^
414 | server.webSocketServer.clients.forEach((client) => {
415 | expect(client.readyState).toBe(WebSocket.OPEN);
416 | });
at Object.<anonymous> (src/tests/client.ts:413:49)
Test Suites: 2 failed, 2 total
Tests: 4 failed, 1 todo, 37 passed, 42 total
Snapshots: 0 total
Time: 4.138 s
Ran all test suites.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Can not `npm test` on Windows, node version 12.13.0 (LTS)
After cloning, I ran npm install. I tried running npm test, but got an error. Full output: C:\Users\soryy\Documents\Software ...
Read more >Node v12.19.0 (LTS)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Read more >npm does not support Node.js v12.18.3 - Stack Overflow
I've installed the latest version of Node.js (12.18.3) on my Windows 10 PC and I'm trying to install a package using npm. When...
Read more >Node_js lts/* failing on Windows - Node.js - Travis CI Community
I think node is not a valid name on Windows (which uses a different Node. js version manager) when it comes to Travis....
Read more >NodeTool@0 - Node.js tool installer v0 task | Microsoft Learn
Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Instead of waiting it might be the better solution to create a deferred promise e.g.:
This has the drawback of the test being stuck until the maximum runtime per test is reached in case the promise is never resolved, but it prevents test case leaking to some extend.
Maybe it would also make more sense to start and tear down the server on a test case level in order to additionally prevent invalid states that leak into the next test case if a single test case fails or is not cleaned up correctly? That will probably increase testing time, but pooling might fix the impact (start 10 servers on 10 different ports; shut down recreate one after each test case etc).
I will tackle this 😃