import { TestSuiteInstance } from '../tests/testSuite' ; import { TestStatus } from '../testStatus' ; import { getTestSuiteInstance } from './utils' ; param name export function FTestSuite < T extends new ( ... args ) => { } > ( name ? ) { return createTestSuiteDecoratorFactory < T > ( TestStatus . Focused , name ) ; } param name export function XTestSuite < T extends new ( ... args ) => { } > ( name ? ) { return createTestSuiteDecoratorFactory < T > ( TestStatus . Ignored , name ) ; } interface TestSuiteDecorator { ( name ? ) : any ; focus : ( name ? : string ) => any ; ignore : ( name ? : string ) => any ; } param name function testSuiteDecorator < T extends new ( ... args ) => { } > ( name ? ) { return createTestSuiteDecoratorFactory < T > ( TestStatus . Normal , name ) ; } param name testSuiteDecorator . focus = FTestSuite ; param name testSuiteDecorator . ignore = XTestSuite ; export const TestSuite = testSuiteDecorator ; deprecated param name export function testSuite < T extends new ( ... args ) => { } > ( name ? ) { return testSuiteDecorator < T > ( name ) ; } deprecated param name export function ftestSuite < T extends new ( ... args ) => { } > ( name ? ) { return FTestSuite < T > ( name ) ; } deprecated param name export function xtestSuite < T extends new ( ... args ) => { } > ( name ? ) { return XTestSuite < T > ( name ) ; } function createTestSuiteDecoratorFactory < T extends new ( ... args ) => { } > ( status , name ? ) { return ( constructor ) => { name = name ? name : constructor . name ; ( constructor as any ) . __testSuiteInstance = createTestSuite ( constructor , name , status ) ; return constructor ; } ; } function createTestSuite < T > ( constructor , name , status ) { const context = new constructor ( ) ; const testSuiteInstance = getTestSuiteInstance ( context ) ; testSuiteInstance . name = name ; testSuiteInstance . status = status ; testSuiteInstance . context = context ; return testSuiteInstance ; }