49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
// ============
|
|
// combines different tap test files to an overall result
|
|
// ============
|
|
import * as plugins from './tstest.plugins.js';
|
|
import { coloredString as cs } from '@push.rocks/consolecolor';
|
|
|
|
import { TapParser } from './tstest.classes.tap.parser.js';
|
|
import * as logPrefixes from './tstest.logprefixes.js';
|
|
import { TsTestLogger } from './tstest.logging.js';
|
|
|
|
export class TapCombinator {
|
|
tapParserStore: TapParser[] = [];
|
|
skippedFiles: string[] = [];
|
|
private logger: TsTestLogger;
|
|
|
|
constructor(logger: TsTestLogger) {
|
|
this.logger = logger;
|
|
}
|
|
|
|
addTapParser(tapParserArg: TapParser) {
|
|
this.tapParserStore.push(tapParserArg);
|
|
}
|
|
|
|
addSkippedFile(filename: string) {
|
|
this.skippedFiles.push(filename);
|
|
}
|
|
|
|
evaluate() {
|
|
// Call the logger's summary method with skipped files
|
|
this.logger.summary(this.skippedFiles);
|
|
|
|
// Check for failures
|
|
let failGlobal = false;
|
|
for (const tapParser of this.tapParserStore) {
|
|
if (!tapParser.expectedTests ||
|
|
tapParser.expectedTests !== tapParser.receivedTests ||
|
|
tapParser.getErrorTests().length > 0) {
|
|
failGlobal = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Exit with error code if tests failed
|
|
if (failGlobal) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
}
|