diff --git a/lib/commands/run-script.js b/lib/commands/run-script.js index 13efdde750a82..75f00a46b84e9 100644 --- a/lib/commands/run-script.js +++ b/lib/commands/run-script.js @@ -207,24 +207,10 @@ class RunScript extends BaseCommand { log.error(err) log.error(` in workspace: ${pkg._id || pkg.name}`) log.error(` at location: ${workspacePath}`) - - const scriptMissing = err.message.startsWith('Missing script') - - // avoids exiting with error code in case there's scripts missing - // in some workspaces since other scripts might have succeeded - if (!scriptMissing) { - process.exitCode = 1 - } - - return scriptMissing + process.exitCode = 1 }) res.push(runResult) } - - // in case **all** tests are missing, then it should exit with error code - if (res.every(Boolean)) { - throw new Error(`Missing script: ${args[0]}`) - } } async listWorkspaces (args, filters) { diff --git a/test/lib/commands/run-script.js b/test/lib/commands/run-script.js index cb54a7f51e900..24f51400e8dfc 100644 --- a/test/lib/commands/run-script.js +++ b/test/lib/commands/run-script.js @@ -781,12 +781,7 @@ t.test('workspaces', async t => { t.test('missing scripts in all workspaces', async t => { const { runScript, RUN_SCRIPTS, cleanLogs } = await mockWorkspaces(t, { exec: null }) - await t.rejects( - runScript.exec(['missing-script']), - /Missing script: missing-script/, - 'should throw missing script error' - ) - + await runScript.exec(['missing-script']) t.match(RUN_SCRIPTS(), []) t.strictSame( cleanLogs(),