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

100% Statements 8/8
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16     51×   51×     51×     51×    
import "reflect-metadata";
 
export function Teardown(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<() => any>) {
 
    let teardownFunctions: Array<string> = Reflect.getMetadata("alsatian:teardown", target);
 
    if (!teardownFunctions) {
      teardownFunctions = []
    }
 
    teardownFunctions.push(propertyKey);
 
    // mark as teardown test method
    Reflect.defineMetadata("alsatian:teardown", teardownFunctions, target);
};