-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Propagate exit codes from failed executions
This fixes `--no-bail` when used with `lerna exec` or `lerna run`, ensuring that it still exits with a non-zero code in the event of a command or script failure. Refs #1374 Fixes #1653
- Loading branch information
Showing
7 changed files
with
200 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,11 +152,24 @@ package-2 | |
|
||
test("--no-bail", async () => { | ||
const cwd = await initFixture("lerna-exec"); | ||
const args = ["exec", "--no-bail", "--concurrency=1", "--", "npm", "run", "fail-or-succeed"]; | ||
const args = ["exec", "--no-bail", "--concurrency=1", "--", "npm", "run", "fail-or-succeed", "--silent"]; | ||
|
||
const { stdout, stderr } = await cliRunner(cwd)(...args); | ||
expect(stderr).toMatch("Failed at the [email protected] fail-or-succeed script"); | ||
expect(stdout).toMatch("failure!"); | ||
expect(stdout).toMatch("success!"); | ||
try { | ||
await cliRunner(cwd)(...args); | ||
} catch (err) { | ||
expect(err.stderr).toMatchInlineSnapshot(` | ||
lerna notice cli __TEST_VERSION__ | ||
lerna info Executing command in 2 packages: "npm run fail-or-succeed --silent" | ||
lerna ERR! Received non-zero exit code 1 during execution | ||
lerna success exec Executed command in 2 packages: "npm run fail-or-succeed --silent" | ||
`); | ||
expect(err.stdout).toMatchInlineSnapshot(` | ||
failure! | ||
success! | ||
`); | ||
expect(err.code).toBe(1); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.