|
|
@ -7,7 +7,6 @@ import { coloredString as cs } from '@pushrocks/consolecolor';
|
|
|
|
import { TestDirectory } from './tstest.classes.testdirectory';
|
|
|
|
import { TestDirectory } from './tstest.classes.testdirectory';
|
|
|
|
import { TapCombinator } from './tstest.classes.tap.combinator';
|
|
|
|
import { TapCombinator } from './tstest.classes.tap.combinator';
|
|
|
|
import { TapParser } from './tstest.classes.tap.parser';
|
|
|
|
import { TapParser } from './tstest.classes.tap.parser';
|
|
|
|
import { threeEighths } from 'figures';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class TsTest {
|
|
|
|
export class TsTest {
|
|
|
|
public testDir: TestDirectory;
|
|
|
|
public testDir: TestDirectory;
|
|
|
@ -56,7 +55,7 @@ export class TsTest {
|
|
|
|
|
|
|
|
|
|
|
|
public async runInNode(fileNameArg: string): Promise<TapParser> {
|
|
|
|
public async runInNode(fileNameArg: string): Promise<TapParser> {
|
|
|
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileNameArg, 'orange')} in node.js runtime.`);
|
|
|
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileNameArg, 'orange')} in node.js runtime.`);
|
|
|
|
console.log(cs(`=`.repeat(16), 'cyan'));
|
|
|
|
console.log(`${cs(`= `.repeat(32), 'cyan')}`);
|
|
|
|
const tapParser = new TapParser(fileNameArg);
|
|
|
|
const tapParser = new TapParser(fileNameArg);
|
|
|
|
|
|
|
|
|
|
|
|
// tsrun options
|
|
|
|
// tsrun options
|
|
|
@ -74,7 +73,7 @@ export class TsTest {
|
|
|
|
|
|
|
|
|
|
|
|
public async runInChrome(fileNameArg: string): Promise<TapParser> {
|
|
|
|
public async runInChrome(fileNameArg: string): Promise<TapParser> {
|
|
|
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileNameArg, 'orange')} in chromium runtime.`);
|
|
|
|
console.log(`${cs('=> ', 'blue')} Running ${cs(fileNameArg, 'orange')} in chromium runtime.`);
|
|
|
|
console.log(cs(`=`.repeat(16), 'cyan'));
|
|
|
|
console.log(`${cs(`= `.repeat(32), 'cyan')}`);
|
|
|
|
|
|
|
|
|
|
|
|
// lets get all our paths sorted
|
|
|
|
// lets get all our paths sorted
|
|
|
|
const tsbundleCacheDirPath = plugins.path.join(paths.cwd, './.nogit/tstest_cache');
|
|
|
|
const tsbundleCacheDirPath = plugins.path.join(paths.cwd, './.nogit/tstest_cache');
|
|
|
@ -148,7 +147,7 @@ export class TsTest {
|
|
|
|
return stringArray.join('');
|
|
|
|
return stringArray.join('');
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let logStore = 'Starting log capture\n';
|
|
|
|
let logStore = '';
|
|
|
|
// tslint:disable-next-line: max-classes-per-file
|
|
|
|
// tslint:disable-next-line: max-classes-per-file
|
|
|
|
const log = console.log.bind(console);
|
|
|
|
const log = console.log.bind(console);
|
|
|
|
console.log = (...args) => {
|
|
|
|
console.log = (...args) => {
|
|
|
@ -166,7 +165,12 @@ export class TsTest {
|
|
|
|
logStore += `${args}\n`;
|
|
|
|
logStore += `${args}\n`;
|
|
|
|
error(...args);
|
|
|
|
error(...args);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const bundle = await (await fetch('/test__test.browser.ts.js')).text();
|
|
|
|
const bundleName = new URLSearchParams(window.location.search).get('bundleName');
|
|
|
|
|
|
|
|
console.log(`::TSTEST IN CHROMIUM:: Relevant Script name is: ${bundleName}`);
|
|
|
|
|
|
|
|
const bundleResponse = await fetch(`/${bundleName}`);
|
|
|
|
|
|
|
|
console.log(`::TSTEST IN CHROMIUM:: Got ${bundleName} with STATUS ${bundleResponse.status}`);
|
|
|
|
|
|
|
|
const bundle = await bundleResponse.text();
|
|
|
|
|
|
|
|
console.log(`::TSTEST IN CHROMIUM:: Executing ${bundleName}`);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// tslint:disable-next-line: no-eval
|
|
|
|
// tslint:disable-next-line: no-eval
|
|
|
|
eval(bundle);
|
|
|
|
eval(bundle);
|
|
|
@ -183,9 +187,9 @@ export class TsTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await this.smartbrowserInstance.stop();
|
|
|
|
await this.smartbrowserInstance.stop();
|
|
|
|
console.log(`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance.`);
|
|
|
|
|
|
|
|
await server.stop();
|
|
|
|
await server.stop();
|
|
|
|
console.log(`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} server.`);
|
|
|
|
console.log(`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance and server.`);
|
|
|
|
|
|
|
|
console.log(`${cs('=> ', 'blue')} See the result captured from the chromium execution:`);
|
|
|
|
// lets create the tap parser
|
|
|
|
// lets create the tap parser
|
|
|
|
const tapParser = new TapParser(fileNameArg);
|
|
|
|
const tapParser = new TapParser(fileNameArg);
|
|
|
|
tapParser.handleTapLog(evaluation);
|
|
|
|
tapParser.handleTapLog(evaluation);
|
|
|
|