expectThrow.js 393 B

123456789101112
  1. export default async promise => {
  2. try {
  3. await promise;
  4. } catch (error) {
  5. // TODO: Check jump destination to destinguish between a throw
  6. // and an actual invalid jump.
  7. const invalidJump = error.message.search('invalid JUMP') >= 0;
  8. assert(invalidJump, "Expected throw, got '" + error + "' instead");
  9. return;
  10. }
  11. assert.fail('Expected throw not received');
  12. };