Fix hotbar migration of workspaces (#3178)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-06-25 09:55:25 -04:00
1 parent b9dfd20a93
commit 51655884c7
39 files changed
+333 -446

No files matched your search

+6 -6
View File
@@ -37,27 +37,27 @@ interface DoneCallback {
* This is necessary because Jest doesn't do this correctly.
* @param fn The function to call
*/
export function wrapJestLifecycle(fn: () => Promise<void>): (done: DoneCallback) => void {
export function wrapJestLifecycle(fn: () => Promise<void> | void): (done: DoneCallback) => void {
return function (done: DoneCallback) {
fn()
(async () => fn())()
.then(() => done())
.catch(error => done.fail(error));
};
}
export function beforeAllWrapped(fn: () => Promise<void>): void {
export function beforeAllWrapped(fn: () => Promise<void> | void): void {
beforeAll(wrapJestLifecycle(fn));
}
export function beforeEachWrapped(fn: () => Promise<void>): void {
export function beforeEachWrapped(fn: () => Promise<void> | void): void {
beforeEach(wrapJestLifecycle(fn));
}
export function afterAllWrapped(fn: () => Promise<void>): void {
export function afterAllWrapped(fn: () => Promise<void> | void): void {
afterAll(wrapJestLifecycle(fn));
}
export function afterEachWrapped(fn: () => Promise<void>): void {
export function afterEachWrapped(fn: () => Promise<void> | void): void {
afterEach(wrapJestLifecycle(fn));
}