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
Have you read the CONTRIBUTING guide on posting bugs, and CODE_OF_CONDUCT?
yes I read the things
This issue exists in the latest tap version
I am using the latest tap
Description
If the code being tested asynchronously handles rejected promises, tap seems to break. In some cases the PromiseRejectionHandledWarning from node also seems to be suppressed, which makes it difficult to understand why tests failed.
Reproduction
A case where the PromiseRejectionHandledWarning seems to be suppressed:
constt=require('tap');asyncfunctionslowFn(delay){awaitnewPromise((resolve)=>{setTimeout(resolve,delay);});};asyncfunctionslowFnThatRejects(delay,x){awaitnewPromise((resolve)=>{setTimeout(resolve,delay);});thrownewError(`rejection value ${x}`)}asyncfunctiondoesWorkBeforeAwaitingPromise(){constp1=slowFnThatRejects(1,'p1');// without this second rejected promise we do get as far as the end of the test, but the test still failsconstp2=slowFnThatRejects(5,'p2');awaitslowFn(20);// we never get this farconsole.log('never reached, but should be');awaitPromise.all([p1,p2]);}t.test('main test 1',asynct=>{awaitt.test('asynchronously handled promise rejection',asynct=>{t.rejects(doesWorkBeforeAwaitingPromise,newError('rejection value p1'),'should reject with p1 rejection value');});});// other tests get messed up too, for some reason (this made this tricky to isolate)t.test('something else',asynct=>{awaitslowFn(50);t.ok('this should be ok');});
A simpler case, where the warning is printed:
constt=require('tap');asyncfunctionslowFn(delay){awaitnewPromise((resolve)=>{setTimeout(resolve,delay);});};asyncfunctionslowFnThatRejects(delay,x){awaitnewPromise((resolve)=>{setTimeout(resolve,delay);});thrownewError(`rejection value ${x}`)}asyncfunctiondoesWorkBeforeAwaitingPromise(){constp1=slowFnThatRejects(1,'p1');awaitslowFn(20);// we do get this far, but we don't return the correct resultawaitp1;}t.test('main test 2',asynct=>{awaitt.test('asynchronously handled promise rejection',asynct=>{t.rejects(doesWorkBeforeAwaitingPromise,newError('rejection value p1'),'should reject with p1 rejection value');});});
Is there an existing issue for this?
Have you read the
CONTRIBUTING
guide on posting bugs, andCODE_OF_CONDUCT
?This issue exists in the latest tap version
Description
If the code being tested asynchronously handles rejected promises, tap seems to break. In some cases the
PromiseRejectionHandledWarning
from node also seems to be suppressed, which makes it difficult to understand why tests failed.Reproduction
A case where the PromiseRejectionHandledWarning seems to be suppressed:
A simpler case, where the warning is printed:
Environment
The text was updated successfully, but these errors were encountered: