Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(npm-publish): Ensure process exits non-zero when
libnpm/publish
…
… fails
- Loading branch information
Showing
3 changed files
with
81 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use strict"; | ||
|
||
const path = require("path"); | ||
|
||
const cliRunner = require("@lerna-test/cli-runner"); | ||
const cloneFixture = require("@lerna-test/clone-fixture")( | ||
path.resolve(__dirname, "../commands/publish/__tests__") | ||
); | ||
|
||
test("lerna publish sets correct exit code when libnpm/publish fails", async () => { | ||
const { cwd } = await cloneFixture("normal"); | ||
|
||
try { | ||
await cliRunner(cwd)("publish", "patch", "--yes", "--no-verify-access", "--loglevel", "error"); | ||
} catch (err) { | ||
expect(err.stderr).toMatchInlineSnapshot(` | ||
lerna ERR! E401 You must be logged in to publish packages. | ||
`); | ||
expect(err.code).toBe(1); | ||
} | ||
|
||
expect.hasAssertions(); | ||
}); |
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