diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index bc9c89a01..5500ebd4d 100644 --- a/packages/cli/CHANGELOG.md +++ b/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 diff --git a/packages/cli/package.json b/packages/cli/package.json index c430b7824..96cad6adb 100644 --- a/packages/cli/package.json +++ b/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" diff --git a/packages/cli/src/run.test.ts b/packages/cli/src/run.test.ts index 8e4b79d40..ed90affca 100644 --- a/packages/cli/src/run.test.ts +++ b/packages/cli/src/run.test.ts @@ -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` + ); + }); + }); }); diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 82b4e41b4..706d95aaa 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -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