1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1× 1× 1× 54× 54× 12× 54× 54× | import "reflect-metadata"; import { TEARDOWN } from "./_metadata-keys"; export function Teardown(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<() => any>) { let teardownFunctions: Array<string> = Reflect.getMetadata(TEARDOWN, target); if (!teardownFunctions) { teardownFunctions = []; } teardownFunctions.push(propertyKey); // mark as teardown test method Reflect.defineMetadata(TEARDOWN, teardownFunctions, target); }; |