import $ from 'jquery'; export function writeTest( name: string, argJSON: string[], retJSON: string ): void { showTest(formatTest(name, argJSON, retJSON)); } // this is decorator for method export function testIt(obj: any, methodname: string, des: any) { var old = des.value; des.value = function(...args: any[]) { return (window as any)._handleTestReports( args, old, 'fdsa,fdas', this, methodname ); }; } function formatTest(functionName: string, argMap: string[], retJSON: string) { return ` describe('${functionName}', ()=>{ it('###should do something###',()=>{ ${argMap.reduce((s, a) => (s += a + '\n\n'), '')} const ret = ${functionName}(${argMap .map((n, i) => 'arg' + i) .join(', ')}); const expectedResult = ${retJSON}; assert.equal(ret, expectedResult); }) }); `; } function showTest(txt: string) { $('