export and use distict lifecycle wrappers

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-03-02 16:46:27 -05:00
1 parent 2e38938331
commit cbe52fefcc
5 files changed
+43 -28

No files matched your search

+16
View File
@@ -25,6 +25,22 @@ export function wrapJestLifecycle(fn: () => Promise<void>): (done: DoneCallback)
};
}
export function beforeAllWrapped(fn: () => Promise<void>): void {
beforeAll(wrapJestLifecycle(fn));
}
export function beforeEachWrapped(fn: () => Promise<void>): void {
beforeEach(wrapJestLifecycle(fn));
}
export function afterAllWrapped(fn: () => Promise<void>): void {
afterAll(wrapJestLifecycle(fn));
}
export function afterEachWrapped(fn: () => Promise<void>): void {
afterEach(wrapJestLifecycle(fn));
}
export function itIf(condition: boolean) {
return condition ? it : it.skip;
}