all files / core/decorators/ timeout-decorator.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13              
import "reflect-metadata";
 
export function Timeout(timeoutInMs: number) {
  if (timeoutInMs <= 0) {
     throw new RangeError("Timeout period must be greater than 0.");
  }
 
  return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => {
 
    Reflect.defineMetadata("alsatian:timeout", timeoutInMs, target, propertyKey);
  };
}