From 07a656a2cc51ac758787b2c7971d89d9ef49288f Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 13:39:34 -0500 Subject: [PATCH 1/6] test2 --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index cdc75a4..5600bbb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,4 +1,4 @@ -name: Test PR +name: Test PRa on: pull_request: types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] From fa782f6faa61984560e5c3c32e9d09b92578d415 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 14:16:13 -0500 Subject: [PATCH 2/6] package for debug --- dist/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 619c90c..9b64fef 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40074,7 +40074,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); let status = response.data.status; let conclusion = response.data.conclusion; - console.log(chalk.green("TestDriver:"), '"Status:"', status); + console.log(chalk.green("TestDriver:"), '"Status:"', status, '"Conclusion:"', conclusion); return { status, conclusion }; }; @@ -40105,7 +40105,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); await waitUntilComplete(); console.log(chalk.green("TestDriver:"), chalk.green('"Done!"')); - console.log(chalk.green("TestDriver:"), '"Writing my report..."'.green); + console.log(chalk.green("TestDriver:"), chalk.green('"Writing my report..."')); const { data: { shareLink, oiResult, exitcode }, @@ -40118,9 +40118,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); - console.log(chalk.green("TestDriver:"), '"Interpreting results..."'.green); + console.log(chalk.green("TestDriver:"), chalk.green('"Interpreting results..."')); - console.log(chalk.green("TestDriver:"), `"Exit Code ${exitcode}"`.green); + console.log(chalk.green("TestDriver:"), chalk.green(`"Exit Code ${exitcode}"`, typeof exitcode)); const isPassed = parseInt(exitcode) === 0; From 9b9bc313301fb177f9f99808ba94138c786f8a7d Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 16:05:21 -0500 Subject: [PATCH 3/6] polish --- dist/index.js | 25 ++++++++++++------------- src/index.js | 25 ++++++++++++------------- test.js | 12 ++++++++++++ 3 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 test.js diff --git a/dist/index.js b/dist/index.js index 9b64fef..62cf749 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40092,20 +40092,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); conclusion = resp.conclusion; } - if (conclusion === "failure") { - console.log( - chalk.green("TestDriver:"), - chalk.red('"The workflow has failed!"') - ); - } - return conclusion; }; - await waitUntilComplete(); + let conc = await waitUntilComplete(); console.log(chalk.green("TestDriver:"), chalk.green('"Done!"')); - console.log(chalk.green("TestDriver:"), chalk.green('"Writing my report..."')); + console.log(chalk.green("TestDriver:"), "Writing my report..."); const { data: { shareLink, oiResult, exitcode }, @@ -40118,9 +40111,14 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); - console.log(chalk.green("TestDriver:"), chalk.green('"Interpreting results..."')); + if (conc === "failure") { + console.log( + chalk.green("Workflow:"), + chalk.red('Failed') + ); + } - console.log(chalk.green("TestDriver:"), chalk.green(`"Exit Code ${exitcode}"`, typeof exitcode)); + console.log(chalk.green("TestDriver:"), "Interpreting results..."); const isPassed = parseInt(exitcode) === 0; @@ -40129,9 +40127,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log(chalk.green("TestDriver:"), chalk.green('"PASS"')); + console.log(chalk.green("Test:"), chalk.green('"PASS"')); } else { - console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"')); + console.log(chalk.green("Test:"), chalk.red('"FAIL"')); } let extractedFromMarkdown = extractLink(shareLink); @@ -40150,6 +40148,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); core.setOutput("summary", oiResult); core.setOutput("link", extractedFromMarkdown); core.setOutput("markdown", shareLink); + core.setOutput("success", isPassed); await core.summary .addHeading("TestDriver.ai Results") diff --git a/src/index.js b/src/index.js index e005281..0b6228a 100644 --- a/src/index.js +++ b/src/index.js @@ -135,20 +135,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); conclusion = resp.conclusion; } - if (conclusion === "failure") { - console.log( - chalk.green("TestDriver:"), - chalk.red('"The workflow has failed!"') - ); - } - return conclusion; }; - await waitUntilComplete(); + let conc = await waitUntilComplete(); console.log(chalk.green("TestDriver:"), chalk.green('"Done!"')); - console.log(chalk.green("TestDriver:"), chalk.green('"Writing my report..."')); + console.log(chalk.green("TestDriver:"), "Writing my report..."); const { data: { shareLink, oiResult, exitcode }, @@ -161,9 +154,14 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); - console.log(chalk.green("TestDriver:"), chalk.green('"Interpreting results..."')); + if (conc === "failure") { + console.log( + chalk.green("Workflow:"), + chalk.red('Failed') + ); + } - console.log(chalk.green("TestDriver:"), chalk.green(`"Exit Code ${exitcode}"`, typeof exitcode)); + console.log(chalk.green("TestDriver:"), "Interpreting results..."); const isPassed = parseInt(exitcode) === 0; @@ -172,9 +170,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log(chalk.green("TestDriver:"), chalk.green('"PASS"')); + console.log(chalk.green("Test:"), chalk.green('"PASS"')); } else { - console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"')); + console.log(chalk.green("Test:"), chalk.red('"FAIL"')); } let extractedFromMarkdown = extractLink(shareLink); @@ -193,6 +191,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); core.setOutput("summary", oiResult); core.setOutput("link", extractedFromMarkdown); core.setOutput("markdown", shareLink); + core.setOutput("success", isPassed); await core.summary .addHeading("TestDriver.ai Results") diff --git a/test.js b/test.js new file mode 100644 index 0000000..4c43a52 --- /dev/null +++ b/test.js @@ -0,0 +1,12 @@ +let exitcode = "0\n" + +console.log(exitcode) +console.log(typeof exitcode) + +const isPassed = parseInt(exitcode) === 0; + +if (!isPassed) { + console.log('failed') +} else { + console.log('passed') +} From 6782f8dc30049262f0f174e71551559e887e964b Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 16:27:05 -0500 Subject: [PATCH 4/6] log cleanup --- src/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 0b6228a..1b6ba41 100644 --- a/src/index.js +++ b/src/index.js @@ -117,8 +117,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); let status = response.data.status; let conclusion = response.data.conclusion; - console.log(chalk.green("TestDriver:"), '"Status:"', status, '"Conclusion:"', conclusion); - return { status, conclusion }; }; @@ -154,14 +152,20 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); + console.log(chalk.green("TestDriver:"), "Interpreting results..."); + if (conc === "failure") { console.log( - chalk.green("Workflow:"), - chalk.red('Failed') + chalk.yellow("Workflow:"), + chalk.red('Fail') + ); + } else { + console.log( + chalk.yellow("Workflow:"), + chalk.green('Pass') ); } - console.log(chalk.green("TestDriver:"), "Interpreting results..."); const isPassed = parseInt(exitcode) === 0; @@ -170,9 +174,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log(chalk.green("Test:"), chalk.green('"PASS"')); + console.log("Test:", chalk.green('Pass')); } else { - console.log(chalk.green("Test:"), chalk.red('"FAIL"')); + console.log("Test:", chalk.red('Fail')); } let extractedFromMarkdown = extractLink(shareLink); From c39007c8bf366b49ed687880a5b58ec1885deb55 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 16:32:02 -0500 Subject: [PATCH 5/6] compile --- dist/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index 62cf749..96550f3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40074,8 +40074,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); let status = response.data.status; let conclusion = response.data.conclusion; - console.log(chalk.green("TestDriver:"), '"Status:"', status, '"Conclusion:"', conclusion); - return { status, conclusion }; }; @@ -40111,14 +40109,20 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } ); + console.log(chalk.green("TestDriver:"), "Interpreting results..."); + if (conc === "failure") { console.log( - chalk.green("Workflow:"), - chalk.red('Failed') + chalk.yellow("Workflow:"), + chalk.red('Fail') + ); + } else { + console.log( + chalk.yellow("Workflow:"), + chalk.green('Pass') ); } - console.log(chalk.green("TestDriver:"), "Interpreting results..."); const isPassed = parseInt(exitcode) === 0; @@ -40127,9 +40131,9 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log(chalk.green("Test:"), chalk.green('"PASS"')); + console.log("Test:", chalk.green('Pass')); } else { - console.log(chalk.green("Test:"), chalk.red('"FAIL"')); + console.log("Test:", chalk.red('Fail')); } let extractedFromMarkdown = extractLink(shareLink); From aa5b0ec72c3bf5213c7cef7d1c3efedae5e1d6f9 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Mon, 24 Jun 2024 17:03:13 -0500 Subject: [PATCH 6/6] test report formatting --- dist/index.js | 12 ++++++++---- src/index.js | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 96550f3..0b6a69a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40111,6 +40111,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); console.log(chalk.green("TestDriver:"), "Interpreting results..."); + console.log('') + console.log('Test Report:') if (conc === "failure") { console.log( chalk.yellow("Workflow:"), @@ -40123,7 +40125,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); ); } - const isPassed = parseInt(exitcode) === 0; if (!isPassed) { @@ -40131,21 +40132,24 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log("Test:", chalk.green('Pass')); + console.log(chalk.yellow("Test:"), chalk.green('Pass')); } else { - console.log("Test:", chalk.red('Fail')); + console.log(chalk.yellow("Test:"), chalk.red('Fail')); } let extractedFromMarkdown = extractLink(shareLink); + console.log('') + console.log(chalk.yellow("View Test Result on Dashcam.io:")); + if (extractedFromMarkdown) { - console.log(chalk.yellow("View Test Results on Dashcam.io")); console.log(extractedFromMarkdown); } else { console.log(chalk.red("Something went wrong with Dashcam")); console.log(shareLink); } + console.log('') console.log(chalk.yellow("TestDriver.ai Summary")); console.log(oiResult); diff --git a/src/index.js b/src/index.js index 1b6ba41..2937449 100644 --- a/src/index.js +++ b/src/index.js @@ -154,6 +154,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); console.log(chalk.green("TestDriver:"), "Interpreting results..."); + console.log('') + console.log('Test Report:') if (conc === "failure") { console.log( chalk.yellow("Workflow:"), @@ -166,7 +168,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); ); } - const isPassed = parseInt(exitcode) === 0; if (!isPassed) { @@ -174,21 +175,24 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); } if (isPassed) { - console.log("Test:", chalk.green('Pass')); + console.log(chalk.yellow("Test:"), chalk.green('Pass')); } else { - console.log("Test:", chalk.red('Fail')); + console.log(chalk.yellow("Test:"), chalk.red('Fail')); } let extractedFromMarkdown = extractLink(shareLink); + console.log('') + console.log(chalk.yellow("View Test Result on Dashcam.io:")); + if (extractedFromMarkdown) { - console.log(chalk.yellow("View Test Results on Dashcam.io")); console.log(extractedFromMarkdown); } else { console.log(chalk.red("Something went wrong with Dashcam")); console.log(shareLink); } + console.log('') console.log(chalk.yellow("TestDriver.ai Summary")); console.log(oiResult);