Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error output not being included in rush test/cover summaries. #2281

Merged
merged 1 commit into from Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@bentley/build-tools",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/build-tools"
}
8 changes: 7 additions & 1 deletion tools/build/bin/betools.js
Expand Up @@ -215,5 +215,11 @@ function pseudolocalizeCommand(options) {
function exec(cmd) {
console.log("Running command:");
console.log(cmd.join(" "));
return child_process.execSync(cmd.join(" "), { encoding: "utf8", stdio: 'inherit' });
try {
return child_process.execSync(cmd.join(" "), { encoding: "utf8", stdio: 'inherit' });
} catch (error) {
if (error.status)
process.exit(error.status);
throw error;
}
}
6 changes: 3 additions & 3 deletions tools/build/scripts/rush/utils.js
Expand Up @@ -4,21 +4,21 @@
*--------------------------------------------------------------------------------------------*/
function logBuildWarning(msg) {
if (process.env.TF_BUILD)
console.log("##vso[task.logissue type=warning;]%s", msg);
console.error("##vso[task.logissue type=warning;]%s", msg);
else
console.error("WARNING: %s", msg);
}

function logBuildError(msg) {
if (process.env.TF_BUILD)
console.log("##vso[task.logissue type=error;]%s", msg);
console.error("##vso[task.logissue type=error;]%s", msg);
else
console.error("ERROR: %s", msg);
}

function failBuild() {
if (process.env.TF_BUILD) {
console.log("##vso[task.complete result=Failed;]DONE")
console.error("##vso[task.complete result=Failed;]DONE")
process.exit(0);
} else {
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions tools/build/src/mocha-reporter/index.ts
Expand Up @@ -15,10 +15,10 @@ const Spec = require("mocha/lib/reporters/spec");
const MochaJUnitReporter = require("mocha-junit-reporter");

function withStdErr(callback: () => void) {
const originalConsoleLog = console.log;
console.log = console.error;
const originalConsoleLog = Base.consoleLog;
Base.consoleLog = console.error;
callback();
console.log = originalConsoleLog;
Base.consoleLog = originalConsoleLog;
}

declare const mocha: any;
Expand Down