SolidOS/solid-logic

Jest test warning

timea-solid opened this issue · 2 comments

node 16.13.2 also on node 15 and 17 when we run npm run testwe get this warning:

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.

Angelo traced the problem to be in
"I stripped it down to findChat where it calls:

await this.store.fetcher?.load(
new NamedNode(chatContainer.value + "index.ttl#this")
);

so this might be a general problem with fetcher.load Perhaps one could reproduce it with an integration test on rdflib"

Hi @theRealImy @angelo-v

One way I found to get rid of the error was to add a very short timeout on line 23 of workspaces/solid-logic/test/chatLogic.test.ts

store.fetcher = rdf.fetcher(store, { fetch: fetchMock, timeout: 5 });

The timeout in rdf.fetcher is set to 30000 (30 seconds) by default, but you can pass a different timeout as an option. It seems that the problem is that the fetcher is still running even after the test has succeeded.

I wonder if this is related to linkeddata/rdflib.js#461, because in my console, I'm seeing
Internal error - fetchQueue exists https://alice.example/IndividualChats/bob.example/index.ttl

So maybe because the fetchQueue exists (which seems to be an rdflib error), the timeout keeps running?

Super find @YetAnotherJonWilson! Let's proceed with your solution for solid-logic.