diff --git a/dist/main.cjs b/dist/main.cjs index de54429..a6cdabe 100644 --- a/dist/main.cjs +++ b/dist/main.cjs @@ -23375,9 +23375,7 @@ async function run() { } var main_default = run().catch((error2) => { console.error(error2); - if (process.env.GITHUB_OUTPUT !== void 0) { - setFailed(error2.message); - } + setFailed(error2.message); }); /*! Bundled license information: diff --git a/main.js b/main.js index ec65c02..47af2fe 100644 --- a/main.js +++ b/main.js @@ -48,10 +48,7 @@ async function run() { // Export promise for testing export default run().catch((error) => { - /* c8 ignore next 5 */ + /* c8 ignore next 3 */ console.error(error); - // Don't set failed in test mode (when GITHUB_OUTPUT is undefined) - if (process.env.GITHUB_OUTPUT !== undefined) { - core.setFailed(error.message); - } + core.setFailed(error.message); }); diff --git a/tests/index.js b/tests/index.js index 11ce4a8..74cf272 100644 --- a/tests/index.js +++ b/tests/index.js @@ -46,9 +46,18 @@ for (const file of testFiles) { NODE_USE_ENV_PROXY, ...env } = process.env; - const { stderr, stdout } = await execFileAsync("node", [`tests/${file}`], { - env, - }); + let stderr, stdout; + try { + ({ stderr, stdout } = await execFileAsync("node", [`tests/${file}`], { + env, + })); + } catch (error) { + if (!(error instanceof Error) || !("stderr" in error) || !("stdout" in error)) { + throw error; + } + + ({ stderr, stdout } = error); + } const trimmedStderr = normalizeStderr(stderr).replace(/\r?\n$/, ""); const trimmedStdout = stdout.replace(/\r?\n$/, ""); await t.test("stderr", (t) => { diff --git a/tests/index.js.snapshot b/tests/index.js.snapshot index ba868b6..2b250a8 100644 --- a/tests/index.js.snapshot +++ b/tests/index.js.snapshot @@ -30,6 +30,7 @@ Error: No enterprise installation found matching the name test-enterprise. exports[`main-enterprise-installation-not-found.test.js > stdout 1`] = ` Creating enterprise installation token for enterprise "test-enterprise". Failed to create token for enterprise "test-enterprise" (attempt 1): No enterprise installation found matching the name test-enterprise. +::error::No enterprise installation found matching the name test-enterprise. --- REQUESTS --- GET /enterprises/test-enterprise/installation `; @@ -44,6 +45,10 @@ Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs at async file:///tests/main-enterprise-mutual-exclusivity-owner.test.js:: `; +exports[`main-enterprise-mutual-exclusivity-owner.test.js > stdout 1`] = ` +::error::Cannot use 'enterprise' input with 'owner' or 'repositories' inputs +`; + exports[`main-enterprise-mutual-exclusivity-repositories.test.js > stderr 1`] = ` Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs at main (file:///lib/main.js::) @@ -54,6 +59,10 @@ Error: Cannot use 'enterprise' input with 'owner' or 'repositories' inputs at async file:///tests/main-enterprise-mutual-exclusivity-repositories.test.js:: `; +exports[`main-enterprise-mutual-exclusivity-repositories.test.js > stdout 1`] = ` +::error::Cannot use 'enterprise' input with 'owner' or 'repositories' inputs +`; + exports[`main-enterprise-only-success.test.js > stdout 1`] = ` Creating enterprise installation token for enterprise "test-enterprise". ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a @@ -117,6 +126,10 @@ exports[`main-proxy-requires-native-support.test.js > stderr 1`] = ` A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step. `; +exports[`main-proxy-requires-native-support.test.js > stdout 1`] = ` +::error::A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step. +`; + exports[`main-repo-skew.test.js > stderr 1`] = ` 'Issued at' claim ('iat') must be an Integer representing the time that the assertion was issued. [@octokit/auth-app] GitHub API time and system time are different by 30 seconds. Retrying request with the difference accounted for.