You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The most straightforward approach would look something like
constiterators=[];process.on('exit',()=>{if(iterators.filter(iter=>!iter.done).length>0){console.warn("found open iterators on process exit");}})exportclassAsyncIterator<T>extendsEventEmitter{protected_state: number;private_readable=false;protected_properties?: {[name: string]: any};protected_propertyCallbacks?: {[name: string]: [(value: any)=>void]};/** Creates a new `AsyncIterator`. */constructor(initialState=OPEN){super();this._state=initialState;iterators.push(this)this.on('newListener',waitForDataListener);}
However, this approach doesn't work with jest as the exit event is not emitted after the test suites have run.
Note that we could also offer some jest specific functionality that checks for iterators that are not closed on the afterEach call back. The benefit there is that you can see specifically which tests are leaving iterators open in a test suite.
The text was updated successfully, but these errors were encountered:
Per @rubensworks comment comunica/comunica#1165 (comment); it would be useful to have a debug mode for asynciterator.
The most straightforward approach would look something like
However, this approach doesn't work with jest as the
exit
event is not emitted after the test suites have run.Note that we could also offer some jest specific functionality that checks for iterators that are not closed on the
afterEach
call back. The benefit there is that you can see specifically which tests are leaving iterators open in a test suite.The text was updated successfully, but these errors were encountered: