Description
When running the functional tests of my dotnet core / angular app I noticed that the NodeJS processes are not stopped after my tests finishes. After 5 minutes after my tests completed, they are still there...
My NUnit OneTimeTearDown()
also seems to be hanging when that happens. I'm guessing that's because I'm trying to dispose the web server in it.
I'm creating the server with _server = new WebApplicationFactory<Startup>()
and calling both _server.Server?.Dispose();
and _server?.Dispose();
in the tests' teardown, just in case.
The culprit section in Startup
is:
if (env.IsDevelopment()) {
spa.UseAngularCliServer(npmScript: "start");
}
I went through the source a bit and in the NpmScriptRunner
, there's an external npm process created that never seems to be killed and no reference to the process
variable is maintained. Where is this process terminated? Could that be it?
More findings:
- When running a single test by itself, the NodeJS processes are terminated, albeit after my test finishes
- I tried reproducing on a newly created angular template project, no luck. It seems to only happen when multiple tests are ran...
Related issues: