All files / test/test-utils wrap.ts

87.5% Statements 7/8
100% Branches 0/0
100% Functions 2/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15      1x 1x   1x 1x           1x  
// XXX: this is also defined in apollo-client
// I'm not sure why mocha doesn't provide something like this, you can't
// always use promises
const wrap = <TArgs>(done: jest.DoneCallback, cb: (...args: TArgs[]) => void) => (
  ...args: TArgs[]
) => {
  try {
    return cb(...args);
  } catch (e) {
    done(e);
  }
};
 
export default wrap;