All files / testing / misc.ts

100.00% Branches 2/2
100.00% Functions 1/1
100.00% Lines 6/6
1
2
3
4
5
6
7
8
9
 
x71
 
 
x71
x16
x16
x16
x16







/** TestingError can be used to test expected error behaviours in tests. */
export class TestingError extends Error {}

/** Throws back an error (can be used where statements are not allowed in syntax). */
export function throws(error: Error | string): never {
  if (typeof error === "string")
    error = new TestingError(error)
  throw error
}