From 46fa7f99f031627cade598e5b1fba466110de614 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Mon, 7 Apr 2025 14:57:12 +0200 Subject: [PATCH] Set exit code for report commands --- src/commands/report/cmd-report-create.test.ts | 2 +- src/commands/report/cmd-report-create.ts | 2 ++ src/commands/report/cmd-report-view.test.ts | 2 +- src/commands/report/cmd-report-view.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/report/cmd-report-create.test.ts b/src/commands/report/cmd-report-create.test.ts index 4425868ed..90d45982e 100644 --- a/src/commands/report/cmd-report-create.test.ts +++ b/src/commands/report/cmd-report-create.test.ts @@ -55,7 +55,7 @@ describe('socket report create', async () => { \\x1b[31m\\xd7\\x1b[39m This command has been sunset. Instead, please look at \`socket scan create\` to create scans and \`socket scan report\` to view a report of your scans." `) - expect(code, 'dry-run should exit with code 0 if input ok').toBe(0) + expect(code).toBe(1) } ) }) diff --git a/src/commands/report/cmd-report-create.ts b/src/commands/report/cmd-report-create.ts index 08fa7bb6d..caa2c9dbb 100644 --- a/src/commands/report/cmd-report-create.ts +++ b/src/commands/report/cmd-report-create.ts @@ -52,4 +52,6 @@ async function run( logger.fail( 'This command has been sunset. Instead, please look at `socket scan create` to create scans and `socket scan report` to view a report of your scans.' ) + + process.exitCode = 1 } diff --git a/src/commands/report/cmd-report-view.test.ts b/src/commands/report/cmd-report-view.test.ts index 4425868ed..90d45982e 100644 --- a/src/commands/report/cmd-report-view.test.ts +++ b/src/commands/report/cmd-report-view.test.ts @@ -55,7 +55,7 @@ describe('socket report create', async () => { \\x1b[31m\\xd7\\x1b[39m This command has been sunset. Instead, please look at \`socket scan create\` to create scans and \`socket scan report\` to view a report of your scans." `) - expect(code, 'dry-run should exit with code 0 if input ok').toBe(0) + expect(code).toBe(1) } ) }) diff --git a/src/commands/report/cmd-report-view.ts b/src/commands/report/cmd-report-view.ts index 80c09206b..ca6c1b58d 100644 --- a/src/commands/report/cmd-report-view.ts +++ b/src/commands/report/cmd-report-view.ts @@ -41,4 +41,6 @@ async function run( logger.fail( 'This command has been sunset. Instead, please look at `socket scan create` to create scans and `socket scan report` to view a report of your scans.' ) + + process.exitCode = 1 }