Dmitri Pisarev 🇷🇺
Posted on May 26, 2020
I want to remember this day as the first day I asked something at StackOverflow and receive a brilliant and non-trivial answer!
Check it out, a way to provision a group of tests with some test data asynchronously while getting some data from the provisioning process:
const setupTestContext = testContext => beforeAll(async () => {
Object.assign(testContext, await setup());
});
...
describe('Some group of tests', async () => {
const someData = {};
setupTestContext(someData);
test('Test1', async () => {
// context is filled with data at this point
const actual = myFunc(someData.x)
...
}
...
})
💖 💪 🙅 🚩
Dmitri Pisarev 🇷🇺
Posted on May 26, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.