-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm test hangs infinitly on windows #4425
Comments
I found it runs horribly on Win10 (other issues, /w some tests). The best solution for me was to use a virtual machine with linux. If you have HyperV capable PC then it's extremely quick to set up a VM. |
This is a known issue, but also difficult to reproduce locally. See the discussion in #1350 and nodejs/node#21210 for more details. To avoid this issue on CI, we are using Node.js 8.x on Windows: Considering that Node.js 8.x is no longer supported by the Node.js project, I think it would be great to take another look at this problem and find a way how to make our test suite pass on Windows versions run by CI provides like AppVeyor, GitHub Actions or Azure Pipelines. |
Re-posting #1431 (comment)
This is the same problem we have been experiencing from the start, see #1350 (comment): looks like there is some other bug on Windows, the test run freezes inside our test suite. I have described details in nodejs/node#21210. In short, the callback installed via |
@bajtos, are you suggesting we should move away using FYI - I was able to reproduce on my home computer - Win10 Home. When running
|
I've tried to replace all |
Alternative to Win 10 native(or full VM) is to set up WSL. VSCode has an extension to connect to remote. Just run test and got following result: 2960 passing (4m)
8 pending
1 failing
1) HttpServer (integration)
reports error when the server cannot be started:
AssertionError: expected [Promise] to be rejected
at Assertion.fail (packages/testlab/node_modules/should/as-function.js:275:17)
at /mnt/i/dev/loopback-next/packages/testlab/node_modules/should/as-function.js:1747:16
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at Context.<anonymous> (packages/http-server/src/__tests__/integration/http-server.integration.ts:204:5) I could write a small guide on setting this up as Windows users might need some hand holding on setting up env in linux. |
@dougal83 I would like to test the WSL approach to continue the work on a PR. Can you send me a guide? |
From what I can remember offhand:
For Ubuntu on WSL bash prompt(powershell >
I think that is most of it. Happy to help if you have any issues. If you can document any issues and resolutions we could put together a guide together if you like. The pro tip is... |
@derdeka @dougal83 thank you for looking into better support for developing LoopBack on Windows ❤️ It would be awesome if you could describe the recommended setup in our developer documentation, see https://github.com/strongloop/loopback-next/blob/master/docs/site/DEVELOPING.md For longer term, I'd like to figure out what's going on under the hood, why are the test freezing on Windows; and hopefully find a fix. I am happy to do the investigation myself, but need to find time in respect to other priorities our team has. |
I am able to reproduce the problem on my personal Windows laptop.
Here is a fast way how to trigger the problem:
|
While debugging the code, I found that My wild guess is that on Unix, The second problem is in the This would be fine on its own if our generators were correctly handling I find it strange that some generators steps are returning My conclusions:
@raymondfeng You are the author of the error handing strategy, could you please take a look at the second item? I'll try to take a look at TTY-related problems myself. |
How to uncover the TTY-related problem on a Unix machine: pipe For example, inside
|
As far as I know, the return value from a generator method does not have impact how the queued steps are executed.
Let me dig into the source code to check. See https://github.com/yeoman/generator/blob/master/lib/index.js#L449. It does check the returned value from the method |
FYI: The intention of @bajtos Does |
I understand that intention, it's just seems that the current implementation does not work as expected. Personally, I'd prefer to have an explicit CLI option like
This is tricky. It usually returns
However, when I run Mocha tests from VS Code debugger, stdin is not TTY ( I think that explains my observations described in #4425 (comment). Unfortunately, it also means that this problem is very difficult to troubleshoot in the debugger. IMO, that's one more reason for abandoning I added some more logging, here is what I am observing. When running the tests in
We call I see two problems here:
|
Based on the discussion with @dhmlau, let's timebox the February work on this issue to one week. Learn more about the problem, fix what can be fixed quickly and then propose the next steps and/or follow-up issues. |
This part can be solved by running the debugger manually via |
AFAICT, when I run tests with stdin read from Few examples:
I am not sure if this is directly related to problems on Windows, but I think it's still worth fixing to make troubleshooting of CLI bugs easier in general. |
On the second thought, I think it's better to discuss this problem in a different issue and keep the discussion here focused on Windows. See #4607 |
@bajtos Happy to confirm tests work on my Win 10 machine. Just say the word and I'll check. |
OK I will review #4643 next. On my main PC via powershell(run as administrator) 3087 passing (5m)
12 pending
5 failing
1) HttpCachingProxy
handles the case where backend service is not running:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (I:\dev\loopback-next\packages\http-caching-proxy\dist\__tests__\integration\http-caching-proxy.integration.js)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
2) HttpServer (integration)
stops server:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (I:\dev\loopback-next\packages\http-server\dist\__tests__\integration\http-server.integration.js)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
3) HttpServer (integration)
stops server with grace period and inflight request:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (I:\dev\loopback-next\packages\http-server\dist\__tests__\integration\http-server.integration.js)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
4) HttpServer (integration)
stops server with shorter grace period and inflight request:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (I:\dev\loopback-next\packages\http-server\dist\__tests__\integration\http-server.integration.js)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
5) app-generator with tilde project path
"before all" hook for "scaffold a new application for tilde-path-app":
AssertionError [ERR_ASSERTION]: true == false
+ expected - actual
-true
+false
at Context.<anonymous> (packages\cli\test\integration\generators\app.integration.js:281:12)
at processImmediate (internal/timers.js:439:21) |
Thank you @dougal83 for reviewing and testing #4643. My take is that we are on the right track and have few more tests to fix. Here are the next steps I see:
Do you have any bandwidth @dougal83 to help me and work on the second or the third task yourself? |
@bajtos I'll take a look at (2). Tilde is used to shorten paths to my knowledge. Hopefully you find (3) the same! |
@bajtos I did wonder why a app.integration.js#L259 appears it should read PR created. |
Fixes error on windows tests. Removes instances of sandbox folder erroniously placed in packages folder. See loopbackio#4425 Signed-off-by: Douglas McConnachie <[email protected]>
Fixes error on windows tests. Removes instances of sandbox folder erroniously placed in packages folder. See #4425 Signed-off-by: Douglas McConnachie <[email protected]>
give windows extra time to complete tests Fix loopbackio#4425 Signed-off-by: Douglas McConnachie <[email protected]>
give windows extra time to complete tests Fix loopbackio#4425 Signed-off-by: Douglas McConnachie <[email protected]>
@bajtos (3) was the same. Thanks for doing all the hard work! ;) |
give windows extra time to complete tests Fix loopbackio#4425 Signed-off-by: Douglas McConnachie <[email protected]>
give windows extra time to complete tests Fix #4425 Signed-off-by: Douglas McConnachie <[email protected]>
Steps to reproduce
npm install
npm test
orDEBUG=mocha:* npm test
Current Behavior
Many tests are executed - one test does not end.
npm test
never ends and runs infinitely.Tried with
cmd
,powershell
and gitbash
.^^^^^^is the last logged console output.
Expected Behavior
npm test
should end successfully or with some error message.Additional information
Windows 10 Pro ver 1909
node v10.15.3
Docker version 19.03.4, build 9013bf5
@loopback/cli version: 1.28.1
when executing
DEBUG=mocha:* npm test
these are the last few log messages:The text was updated successfully, but these errors were encountered: