2018-08-04 15:13:01 +00:00
|
|
|
import * as plugins from './tstest.plugins';
|
|
|
|
import * as paths from './tstest.paths';
|
2018-08-05 21:20:32 +00:00
|
|
|
import * as logPrefixes from './tstest.logprefixes';
|
|
|
|
|
2018-08-04 12:23:07 +00:00
|
|
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
|
|
|
|
2018-08-04 15:13:01 +00:00
|
|
|
import { TestDirectory } from './tstest.classes.testdirectory';
|
2018-08-13 21:58:50 +00:00
|
|
|
import { TapCombinator } from './tstest.classes.tap.combinator';
|
|
|
|
import { TapParser } from './tstest.classes.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-13 21:58:50 +00:00
|
|
|
console.log(cs(plugins.figures.hamburger.repeat(80), 'cyan'));
|
|
|
|
console.log('');
|
|
|
|
console.log(`${logPrefixes.TsTestPrefix} FOUND ${fileNamesToRun.length} TESTFILE(S):`);
|
2018-08-03 17:18:42 +00:00
|
|
|
for (const fileName of fileNamesToRun) {
|
2018-08-05 21:20:32 +00:00
|
|
|
console.log(`${logPrefixes.TsTestPrefix} ${cs(fileName, 'orange')}`);
|
2018-08-03 17:18:42 +00:00
|
|
|
}
|
2018-08-13 21:58:50 +00:00
|
|
|
console.log('-'.repeat(48));
|
2018-08-04 17:23:17 +00:00
|
|
|
console.log(''); // force new line
|
2018-08-03 17:18:42 +00:00
|
|
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
2018-08-04 15:13:01 +00:00
|
|
|
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) {
|
2018-08-04 15:13:01 +00:00
|
|
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileName, 'orange')}`);
|
2018-08-04 17:23:17 +00:00
|
|
|
console.log(cs(`=`.repeat(16), 'cyan'));
|
2018-08-05 20:58:52 +00:00
|
|
|
const tapParser = new TapParser(fileName);
|
2018-12-05 23:38:03 +00:00
|
|
|
|
|
|
|
// tsrun options
|
|
|
|
let tsrunOptions = ''
|
|
|
|
if(process.argv.includes('--web')) {
|
|
|
|
tsrunOptions += ' --web'
|
|
|
|
}
|
|
|
|
|
|
|
|
const execResultStreaming = await smartshellInstance.execStreamingSilent(`tsrun ${fileName}${tsrunOptions}`);
|
2018-08-03 17:18:42 +00:00
|
|
|
await tapParser.handleTapProcess(execResultStreaming.childProcess);
|
2018-08-04 17:23:17 +00:00
|
|
|
console.log(cs(`^`.repeat(16), 'cyan'));
|
|
|
|
console.log(''); // force new line
|
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
|
|
|
}
|
|
|
|
}
|