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
I would expect the following test suite to correctly pass, but the last test case fails as it isn't skipped. test.skipIf evaluates the conditions before the beforeAll method ran which might be correct by design, but my expectation is to set up my test conditions inside the beforeAll method.
It is inconsistent that a test should be skipped based on a condition, but inside the test function this condition might be true.
describe("Skip Test",()=>{constscopedVar=["a"];beforeAll(()=>{scopedVar.push("injected");});test.skipIf(scopedVar.includes("a"))("Should be skipped based on scopedVar",()=>{expect().fail();});test.skipIf(scopedVar.includes("b"))("Should not be skipped based on scopedVar",()=>{expect().pass();});test.skipIf(scopedVar.includes("injected"))("Should be skipped based on beforeAll",()=>{//Evaluation here shows that scopedVar actually includes "injected"console.log(scopedVar);expect().fail();});});
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
Unfortunately, test.skipIf does not receive a "function call" as a parameter- the call to scopedVar.includes(...) evaluates when the describe block runs, then the return value gets passed. This is not a bug in Bun; this is how pass-by-value works.
What version of Bun is running?
1.2.6-canary.3+a79f92df9
What platform is your computer?
No response
What steps can reproduce the bug?
I would expect the following test suite to correctly pass, but the last test case fails as it isn't skipped.
test.skipIf
evaluates the conditions before thebeforeAll
method ran which might be correct by design, but my expectation is to set up my test conditions inside thebeforeAll
method.It is inconsistent that a test should be skipped based on a condition, but inside the test function this condition might be true.
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: