[Gradle, JS] Only one sender of team city stdOut messages
- NodeJS and Browser tests should use one code to send TeamCity messages
This commit is contained in:
@@ -108,8 +108,6 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
|
||||
|
||||
const formatError = createFormatError(config, emitter);
|
||||
|
||||
this.TEST_STD_OUT = "##teamcity[testStdOut name='%s' out='%s' flowId='']";
|
||||
|
||||
const END_KOTLIN_TEST = "'--END_KOTLIN_TEST--";
|
||||
|
||||
const tcOnBrowserStart = this.onBrowserStart;
|
||||
@@ -134,7 +132,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
|
||||
}
|
||||
|
||||
if (browserResult) {
|
||||
browserResult.consoleCollector.push(`[${type}] ${log}\n`)
|
||||
browserResult.consoleCollector.push(log.slice(1, -1))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,13 +141,10 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
|
||||
tcSpecSuccess.call(this, browser, result);
|
||||
|
||||
const log = this.getLog(browser, result);
|
||||
const testName = result.description;
|
||||
|
||||
const endMessage = log.pop();
|
||||
this.browserResults[browser.id].consoleResultCollector[concatenateFqn(result)].forEach(item => {
|
||||
log.push(
|
||||
formatMessage(this.TEST_STD_OUT, testName, item)
|
||||
)
|
||||
log.push(item)
|
||||
});
|
||||
log.push(endMessage);
|
||||
};
|
||||
@@ -160,9 +155,7 @@ const KarmaKotlinReporter = function (baseReporterDecorator, config, emitter) {
|
||||
|
||||
log.push(formatMessage(this.TEST_START, testName));
|
||||
this.browserResults[browser.id].consoleResultCollector[concatenateFqn(result)].forEach(item => {
|
||||
log.push(
|
||||
formatMessage(this.TEST_STD_OUT, testName, item)
|
||||
)
|
||||
log.push(item)
|
||||
});
|
||||
|
||||
log.push(formatMessage(this.TEST_FAILED, testName,
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
import {CliArgsParser, getDefaultCliDescription} from "./src/CliArgsParser";
|
||||
import {getFilteringAdapter} from "./src/Adapter";
|
||||
import {TeamCityMessagesFlow} from "./src/TeamCityMessagesFlow";
|
||||
import {runWithTeamCityReporter} from "./src/KotlinTestTeamCityReporter";
|
||||
|
||||
const kotlin_test = require('kotlin-test');
|
||||
|
||||
@@ -20,7 +22,12 @@ const parser = new CliArgsParser(cliDescription);
|
||||
const untypedArgs = parser.parse(processArgs);
|
||||
|
||||
const initialAdapter = kotlin_test.kotlin.test.detectAdapter_8be2vx$();
|
||||
kotlin_test.setAdapter(getFilteringAdapter(initialAdapter, untypedArgs));
|
||||
|
||||
const realConsoleLog = console.log;
|
||||
const teamCity = new TeamCityMessagesFlow(null, (payload) => realConsoleLog(payload));
|
||||
const teamCityAdapter = runWithTeamCityReporter(initialAdapter, teamCity);
|
||||
|
||||
kotlin_test.setAdapter(getFilteringAdapter(teamCityAdapter, untypedArgs));
|
||||
|
||||
const resultFun = window.__karma__.result;
|
||||
window.__karma__.result = function (result) {
|
||||
|
||||
@@ -2,8 +2,6 @@ import {KotlinTestRunner} from "./KotlinTestRunner";
|
||||
import {TeamCityMessageData, TeamCityMessagesFlow} from "./TeamCityMessagesFlow";
|
||||
import {format} from "util";
|
||||
|
||||
const kotlin_test = require('kotlin-test');
|
||||
|
||||
// don't use enum as it is not minified by uglify
|
||||
export type IgnoredTestSuitesReporting
|
||||
= "skip" | "reportAsIgnoredTest" | "reportAllInnerTestsAsIgnored"
|
||||
|
||||
Reference in New Issue
Block a user