Skip to content

Commit 43e15c3

Browse files
Updated tests for minor changes to help and usage CLI output
1 parent 8ee0fe8 commit 43e15c3

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/cli/parse-args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
8787
}
8888

8989
function errorHandler(error: Error): never {
90-
console.error(`${error.name}: ${error.message}`);
90+
console.error(error.message);
9191
console.error(usageText);
9292
return process.exit(ExitCode.InvalidArgument);
9393
}

test/specs/cli.spec.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ describe("bump", () => {
2424
expect(cli).to.have.exitCode(9);
2525
expect(cli).to.have.stdout("");
2626
expect(cli.stderr).to.match(/^Unknown option: --fizzbuzz\n\nUsage: bump \[release\] \[options\] \[files...\]\n/);
27-
expect(cli.stderr).to.contain(manifest.description);
2827
});
2928

3029
it("should error if an invalid shorthand argument is used", () => {
@@ -33,7 +32,6 @@ describe("bump", () => {
3332
expect(cli).to.have.exitCode(9);
3433
expect(cli).to.have.stdout("");
3534
expect(cli.stderr).to.match(/^Unknown option: -z\n\nUsage: bump \[release\] \[options\] \[files...\]\n/);
36-
expect(cli.stderr).to.contain(manifest.description);
3735
});
3836

3937
it("should error if an argument is missing its value", () => {
@@ -44,7 +42,6 @@ describe("bump", () => {
4442
expect(cli.stderr).to.match(
4543
/^The --preid option requires a value, such as "alpha", "beta", etc\.\n\nUsage: bump \[release\] \[options\] \[files...\]\n/
4644
);
47-
expect(cli.stderr).to.contain(manifest.description);
4845
});
4946

5047
it("should print a more detailed error if DEBUG is set", () => {
@@ -68,35 +65,35 @@ describe("bump", () => {
6865

6966
expect(cli).to.have.exitCode(0);
7067
expect(cli).to.have.stderr("");
71-
expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/);
7268
expect(cli.stdout).to.contain(manifest.description);
69+
expect(cli.stdout).to.match(/\nUsage: bump \[release\] \[options\] \[files...\]\n/);
7370
});
7471

7572
it("should support -h shorthand", () => {
7673
let cli = bump("-h");
7774

7875
expect(cli).to.have.exitCode(0);
7976
expect(cli).to.have.stderr("");
80-
expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/);
8177
expect(cli.stdout).to.contain(manifest.description);
78+
expect(cli.stdout).to.match(/\nUsage: bump \[release\] \[options\] \[files...\]\n/);
8279
});
8380

8481
it("should ignore other arguments", () => {
8582
let cli = bump("--quiet --help --tag");
8683

8784
expect(cli).to.have.exitCode(0);
8885
expect(cli).to.have.stderr("");
89-
expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/);
9086
expect(cli.stdout).to.contain(manifest.description);
87+
expect(cli.stdout).to.match(/\nUsage: bump \[release\] \[options\] \[files...\]\n/);
9188
});
9289

9390
it("should ignore other shorthand arguments", () => {
9491
let cli = bump("-cht");
9592

9693
expect(cli).to.have.exitCode(0);
9794
expect(cli).to.have.stderr("");
98-
expect(cli.stdout).to.match(/^\nUsage: bump \[release\] \[options\] \[files...\]\n/);
9995
expect(cli.stdout).to.contain(manifest.description);
96+
expect(cli.stdout).to.match(/\nUsage: bump \[release\] \[options\] \[files...\]\n/);
10097
});
10198
});
10299

0 commit comments

Comments
 (0)