Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): typo in changeset pre enter when tag is not passed #1344

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
@@ -1,5 +1,11 @@
# @changesets/cli

## 2.27.2

### Patch Changes

- Fix typo in `changeset pre enter` command when tag is not passed

## 2.27.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@changesets/cli",
"version": "2.27.1",
"version": "2.27.2",
"description": "Organise your package versioning and publishing to make both contributors and maintainers happy",
"bin": {
"changeset": "bin.js"
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/src/run.test.ts
Expand Up @@ -99,4 +99,30 @@ describe("cli", () => {
);
});
});
describe("pre", () => {
it("should throw an error if tag not passed in", async () => {
const cwd = await testdir({
"package.json": JSON.stringify({
private: true,
workspaces: ["packages/*"],
}),
"packages/pkg-a/package.json": JSON.stringify({
name: "pkg-a",
version: "1.0.0",
}),
".changeset/config.json": JSON.stringify({}),
});
try {
await run(["pre", "enter"], {}, cwd);
} catch (e) {
// ignore the error. We just want to validate the error message
}

const loggerErrorCalls = (error as any).mock.calls;
expect(loggerErrorCalls.length).toEqual(1);
expect(loggerErrorCalls[0][0]).toEqual(
`A tag must be passed when using prerelease enter`
);
});
});
});
2 changes: 1 addition & 1 deletion packages/cli/src/run.ts
Expand Up @@ -192,7 +192,7 @@ export async function run(
}
let tag = input[2];
if (command === "enter" && typeof tag !== "string") {
error(`A tag must be passed when using prerelese enter`);
error(`A tag must be passed when using prerelease enter`);
throw new ExitError(1);
}
// @ts-ignore
Expand Down