mirror of
https://github.com/encounter/yarn.git
synced 2026-03-30 11:43:44 -07:00
7ba8cfadb6
This commit also fixes a few rebase conflicts
15 lines
346 B
JavaScript
15 lines
346 B
JavaScript
/* @flow */
|
|
|
|
export default function(title: string, fn: () => ?Promise<any>, test?: typeof it = it) {
|
|
let promise;
|
|
try {
|
|
// first run the test
|
|
promise = fn();
|
|
} catch (error) {
|
|
promise = Promise.reject(error);
|
|
}
|
|
|
|
// then register a test with existing (already running) promise
|
|
test(title, (): ?Promise<any> => promise);
|
|
}
|