tstest/ts/tstest.classes.tstest.ts

40 lines
1.5 KiB
TypeScript
Raw Normal View History

import * as plugins from './tstest.plugins';
import * as paths from './tstest.paths';
2018-08-04 12:23:07 +00:00
import { coloredString as cs } from '@pushrocks/consolecolor';
import { TestDirectory } from './tstest.classes.testdirectory';
import { TapCombinator } from './tstest.tap.combinator';
import { TapParser } from './tstest.tap.parser';
2018-08-03 17:18:42 +00:00
export class TsTest {
testDir: TestDirectory;
constructor(cwdArg: string, relativePathToTestDirectory: string) {
this.testDir = new TestDirectory(cwdArg, relativePathToTestDirectory);
}
async run() {
const fileNamesToRun: string[] = await this.testDir.getTestFilePathArray();
2018-08-04 12:23:07 +00:00
console.log(`Found ${fileNamesToRun.length} Testfile(s):`);
2018-08-03 17:18:42 +00:00
for (const fileName of fileNamesToRun) {
console.log(cs(fileName, 'orange'));
2018-08-03 17:18:42 +00:00
}
console.log('-'.repeat(16));
2018-08-03 17:18:42 +00:00
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
pathDirectories: [paths.binDirectory],
2018-08-03 17:18:42 +00:00
sourceFilePaths: []
});
const tapCombinator = new TapCombinator(); // lets create the TapCombinator
for (const fileName of fileNamesToRun) {
console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`);
2018-08-04 12:23:07 +00:00
console.log(`=`.repeat(16));
2018-08-03 17:18:42 +00:00
const tapParser = new TapParser();
const execResultStreaming = await smartshellInstance.execStreamingSilent(`tsrun ${fileName}`);
2018-08-03 17:18:42 +00:00
await tapParser.handleTapProcess(execResultStreaming.childProcess);
2018-08-04 12:23:07 +00:00
tapCombinator.addTapParser(tapParser);
2018-08-03 17:18:42 +00:00
}
2018-08-04 12:23:07 +00:00
tapCombinator.evaluate();
2018-08-03 17:18:42 +00:00
}
}