Skip to content

Commit

Permalink
Merge pull request #3178 from NomicFoundation/show-stack-traces-on-cis
Browse files Browse the repository at this point in the history
Always show stack traces on CI servers
  • Loading branch information
alcuadrado authored Sep 14, 2022
2 parents 061050a + 1093aa4 commit acb5365
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-paws-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Always show stack traces on CI servers
7 changes: 5 additions & 2 deletions packages/hardhat-core/src/internal/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
const log = debug("hardhat:core:cli");

const ANALYTICS_SLOW_TASK_THRESHOLD = 300;
const SHOULD_SHOW_STACK_TRACES_BY_DEFAULT = isRunningOnCiServer();

async function printVersionMessage(packageJson: PackageJson) {
console.log(packageJson.version);
Expand Down Expand Up @@ -106,7 +107,9 @@ async function suggestInstallingHardhatVscode() {
async function main() {
// We first accept this argument anywhere, so we know if the user wants
// stack traces before really parsing the arguments.
let showStackTraces = process.argv.includes("--show-stack-traces");
let showStackTraces =
process.argv.includes("--show-stack-traces") ||
SHOULD_SHOW_STACK_TRACES_BY_DEFAULT;

try {
const packageJson = await getPackageJson();
Expand Down Expand Up @@ -328,7 +331,7 @@ async function main() {
log("Couldn't report error to sentry: %O", e);
}

if (showStackTraces) {
if (showStackTraces || SHOULD_SHOW_STACK_TRACES_BY_DEFAULT) {
console.error(error);
} else {
if (!isHardhatError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const HARDHAT_PARAM_DEFINITIONS: HardhatParamDefinitions = {
showStackTraces: {
name: "showStackTraces",
defaultValue: false,
description: "Show stack traces.",
description: "Show stack traces (always enabled on CI servers).",
type: types.boolean,
isFlag: true,
isOptional: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-core/test/internal/cli/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const coreParams = [
name: "--network",
},
{
description: "Show stack traces.",
description: "Show stack traces (always enabled on CI servers).",
name: "--show-stack-traces",
},
versionParam,
Expand Down

0 comments on commit acb5365

Please sign in to comment.