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 just tried Sazerac and it looks awesome. Unfortunately, I couldn't make it work for a very common test scenario of mine, which look something like this (I use Jest):
beforeAll(someFunctionThatReturnsPromise);beforeEach(anotherAsyncFunc);beforeEach(afterEachAsyncToo);describe('resovers chain',()=>{beforeEach(asyncFuncForAGroupOfTests);it('should do some async check',async()=>{constresult=awaittestedAsyncFunc(givenArgs);expect(result).toBeDefined();});});
First I tried something like:
construn=someAsyncFunctest(run,()=>{given({days: 1}).assert('something about days',async(r)=>{expect(r).toHaveProperty('someprop',7);});});
This failed because assert invoked jest test in sync manner.
beforeAll(someFunctionThatReturnsPromise);beforeEach(anotherAsyncFunc);beforeEach(afterEachAsyncToo);construn=(vars: Variables)=>asyncFunc(query,vars);constpromisify=(assertFn: (value: any)=>void)=>(p: Promise<any>)=>p.then(assertFn);test(run,()=>{given({days: 1}).assert('something about days',promisify((r)=>{expect(r).toHaveProperty('data.lastMeasurements',null);}));})
This worked for some tests, but failed for some others, because global beforeEach didn't fire, I guess. Probably I could promisify beforeEach too and attach it to each given TestCase, but this way all the clarity that sazerac gives to sync test cases will be gone.
I checked sazerac source code and it seems that adding async support will require huge changes. So this is too much for me to make a PR. Besides, I'm only familiar with jest.
So is there any chance you could add Promises support to sazerac?
The text was updated successfully, but these errors were encountered:
I just tried Sazerac and it looks awesome. Unfortunately, I couldn't make it work for a very common test scenario of mine, which look something like this (I use Jest):
First I tried something like:
This failed because assert invoked jest test in sync manner.
This worked for some tests, but failed for some others, because global
beforeEach
didn't fire, I guess. Probably I could promisifybeforeEach
too and attach it to eachgiven
TestCase, but this way all the clarity that sazerac gives to sync test cases will be gone.I checked sazerac source code and it seems that adding async support will require huge changes. So this is too much for me to make a PR. Besides, I'm only familiar with jest.
So is there any chance you could add Promises support to sazerac?
The text was updated successfully, but these errors were encountered: