tstest/ts/tstest.classes.tstest.ts

40 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-08-04 12:23:07 +00:00
import * as plugins from "./tstest.plugins";
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) {
2018-08-04 12:23:07 +00:00
console.log(cs(fileName, "orange"));
2018-08-03 17:18:42 +00:00
}
2018-08-04 12:23:07 +00:00
console.log("-".repeat(16));
2018-08-03 17:18:42 +00:00
const smartshellInstance = new plugins.smartshell.Smartshell({
2018-08-04 12:23:07 +00:00
executor: "bash",
2018-08-03 17:18:42 +00:00
sourceFilePaths: []
});
const tapCombinator = new TapCombinator(); // lets create the TapCombinator
for (const fileName of fileNamesToRun) {
2018-08-04 12:23:07 +00:00
console.log(`${cs("=> ", "blue")} Running ${cs(fileName, "orange")}`);
console.log(`=`.repeat(16));
2018-08-03 17:18:42 +00:00
const tapParser = new TapParser();
2018-08-04 12:23:07 +00:00
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
}
}