Skip to content

Commit

Permalink
Merge pull request #1859 from zowe/next-v3-err-fmt
Browse files Browse the repository at this point in the history
Only one error format for V3 & remove references to bright
  • Loading branch information
zFernand0 authored Nov 14, 2023
2 parents deb86b2 + 5181eb2 commit 819985f
Show file tree
Hide file tree
Showing 92 changed files with 308 additions and 1,233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("Zowe CLI Logging", () => {
expect(imperativeLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0);
expect(imperativeLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0);

// ensure that the password and encoded auth does not appear in the brightside log
// ensure that the password and encoded auth does not appear in the Zowe log
expect(zoweLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0);
expect(zoweLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0);
});
Expand Down Expand Up @@ -83,7 +83,7 @@ describe("Zowe CLI Logging", () => {
expect(imperativeLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0);
expect(imperativeLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0);

// ensure that the password and encoded auth does not appear in the brightside log
// ensure that the password and encoded auth does not appear in the Zowe log
expect(zoweLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0);
expect(zoweLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0);
});
Expand Down
1 change: 0 additions & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- LTS Breaking: Alter the format of error messages to be more clear and actionable.
- LTS Breaking: Remove the ```bright``` command from the product.

## `8.0.0-next.202311132045`

- Breaking: First major version bump for V3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,3 @@ exports[`provisioning delete should display the help 1`] = `
\\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Deletes instance previously provisioned with z/OSMF cloud provisioning services.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe provisioning delete <command>\\\\n\\\\n Where <command> is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n instance | i Deletes instance.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\"
}"
`;
exports[`provisioning delete should fail with invalid option 1`] = `
"Command Error:
Unknown arguments: foo-bar, fooBar
Command failed due to improper syntax
Command entered: \\"provisioning delete instance --foo-bar\\"
Available commands are \\"instance\\".
Use \\"zowe provisioning delete --help\\" to view groups, commands, and options.
Error Details:
Unknown arguments: foo-bar, fooBar
"
`;
exports[`provisioning delete should fail with invalid option 2`] = `""`;
exports[`provisioning delete should fail with invalid parameter 1`] = `
"Command Error:
Unknown argument: foobar
Command failed due to improper syntax
Did you mean: provisioning delete i?
Command entered: \\"provisioning delete foobar\\"
Available commands are \\"instance\\".
Use \\"zowe provisioning delete --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: foobar
"
`;
exports[`provisioning delete should fail with invalid parameter 2`] = `""`;
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ describe("provisioning delete", () => {
it("should fail with invalid parameter", async () => {
const response = runCliScript(__dirname + "/__scripts__/delete_invalid_parameter.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toBe('');
expect(response.stderr.toString()).toContain('Unknown argument: foobar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Did you mean: provisioning delete');
expect(response.stderr.toString()).toContain('Command entered: "provisioning delete foobar"');
expect(response.stderr.toString()).toContain('Available commands are "instance".');
expect(response.stderr.toString()).toContain('Use "zowe provisioning delete --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar');
});

it("should fail with invalid option", async () => {
const response = runCliScript(__dirname + "/__scripts__/delete_invalid_option.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toBe('');
expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Command entered: "provisioning delete instance --foo-bar"');
expect(response.stderr.toString()).toContain('Available commands are "instance".');
expect(response.stderr.toString()).toContain('Use "zowe provisioning delete --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,3 @@ exports[`provisioning provision should display the help 1`] = `
\\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Using z/OSMF cloud provisioning services provision available templates.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe provisioning provision <command>\\\\n\\\\n Where <command> is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n template | tem Provision a published software service template.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\"
}"
`;
exports[`provisioning provision should fail with invalid option 1`] = `
"Command Error:
Unknown arguments: foo-bar, fooBar
Command failed due to improper syntax
Command entered: \\"provisioning provision template --foo-bar\\"
Available commands are \\"template\\".
Use \\"zowe provisioning provision --help\\" to view groups, commands, and options.
Error Details:
Unknown arguments: foo-bar, fooBar
"
`;
exports[`provisioning provision should fail with invalid option 2`] = `""`;
exports[`provisioning provision should fail with invalid parameter 1`] = `
"Command Error:
Unknown argument: foobar
Command failed due to improper syntax
Did you mean: provisioning provision tem?
Command entered: \\"provisioning provision foobar\\"
Available commands are \\"template\\".
Use \\"zowe provisioning provision --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: foobar
"
`;
exports[`provisioning provision should fail with invalid parameter 2`] = `""`;
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ describe("provisioning provision", () => {
it("should fail with invalid parameter", async () => {
const response = runCliScript(__dirname + "/__scripts__/provision_invalid_parameter.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toBe('');
expect(response.stderr.toString()).toContain('Unknown argument: foobar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Did you mean: provisioning provision');
expect(response.stderr.toString()).toContain('Command entered: "provisioning provision foobar"');
expect(response.stderr.toString()).toContain('Available commands are "template".');
expect(response.stderr.toString()).toContain('Use "zowe provisioning provision --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar');
});

it("should fail with invalid option", async () => {
const response = runCliScript(__dirname + "/__scripts__/provision_invalid_option.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toBe('');
expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Command entered: "provisioning provision template --foo-bar"');
expect(response.stderr.toString()).toContain('Available commands are "template".');
expect(response.stderr.toString()).toContain('Use "zowe provisioning provision --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar');
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e

echo "================Z/OS CONSOLE INVALID PARAMETERS==============="
echo "================Z/OS CONSOLE INVALID OPTION==============="
zowe zos-console --foo-bar
exit $?
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,3 @@ exports[`zos-console should display the help 1`] = `
\\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Interact with z/OSMF console services. Issue z/OS console commands and collect\\\\n responses. z/OS console services establishes extended MCS (EMCS) consoles on\\\\n behalf of the user, which are used to issue the commands and collect responses.\\\\n\\\\n Important! Before you use commands in the zos-console command group, ensure that\\\\n you understand the implications of issuing z/OS console commands in your\\\\n environment.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-console <group>\\\\n\\\\n Where <group> is one of the following:\\\\n\\\\n GROUPS\\\\n ------\\\\n\\\\n collect Collect z/OS console command responses\\\\n issue Issue z/OS console commands \\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\"
}"
`;
exports[`zos-console should fail with invalid option 1`] = `
"Command Error:
Unknown arguments: foo-bar, fooBar
Command failed due to improper syntax
Did you mean: zos-console collect?
Command entered: \\"zos-console --foo-bar\\"
Use \\"zowe zos-console --help\\" to view groups, commands, and options.
Error Details:
Unknown arguments: foo-bar, fooBar
"
`;
exports[`zos-console should fail with invalid option 2`] = `
"================Z/OS CONSOLE INVALID PARAMETERS===============
"
`;
exports[`zos-console should fail with invalid parameter 1`] = `
"Command Error:
Unknown argument: foobar
Command failed due to improper syntax
Did you mean: zos-console collect?
Command entered: \\"zos-console foobar\\"
Use \\"zowe zos-console --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: foobar
"
`;
exports[`zos-console should fail with invalid parameter 2`] = `
"================Z/OS CONSOLE INVALID PARAMETERS===============
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,24 @@ describe("zos-console", () => {
it("should fail with invalid parameter", async () => {
const response = runCliScript(__dirname + "/__scripts__/invalid_parameter.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID PARAMETERS===============');
expect(response.stderr.toString()).toContain('Unknown argument: foobar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Did you mean: zos-console collect');
expect(response.stderr.toString()).toContain('Command entered: "zos-console foobar"');
expect(response.stderr.toString()).toContain('Use "zowe zos-console --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar');
});

it("should fail with invalid option", async () => {
const response = runCliScript(__dirname + "/__scripts__/invalid_option.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toMatchSnapshot();
expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID OPTION===============');
expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar');
expect(response.stderr.toString()).toContain('Command failed due to improper syntax');
expect(response.stderr.toString()).toContain('Did you mean: zos-console collect');
expect(response.stderr.toString()).toContain('Command entered: "zos-console --foo-bar"');
expect(response.stderr.toString()).toContain('Use "zowe zos-console --help" to view groups, commands, and options.');
expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,6 @@ exports[`zos-jobs submit data-set command should display the help 1`] = `
}"
`;
exports[`zos-jobs submit data-set command syntax errors should occur if an extra unknown option is specified 1`] = `
"Command Error:
Unknown argument: blah
Command failed due to improper syntax
Command entered: \\"zos-jobs submit data-set DATA.SET blah\\"
Available commands are \\"data-set, local-file, stdin, uss-file\\".
Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: blah
"
`;
exports[`zos-jobs submit data-set command syntax errors should occur if both --wait-for-active and --directory is specified 1`] = `
"
Syntax Error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ describe("zos-jobs submit data-set command", () => {
const response = runCliScript(__dirname + "/__scripts__/submit_syntax_invalid_parm.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stdout.toString()).toBe("");
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stderr.toString()).toContain("Unknown argument: blah");
expect(response.stderr.toString()).toContain("Command failed due to improper syntax");
expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit data-set DATA.SET blah"');
expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".');
expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.');
});

it("should occur if both --wait-for-active and --directory is specified", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,6 @@ Use \\"zowe zos-jobs submit local-file --help\\" to view command description, us
"
`;
exports[`zos-jobs submit local-file command syntax errors should occur if an extra unknown option is specified 1`] = `
"Command Error:
Unknown argument: blah
Command failed due to improper syntax
Command entered: \\"zos-jobs submit local-file ../../../../packages/cli/__tests__/zosjobs/__integration__/submit/local-file/testFileOfLocalJCL.txt blah\\"
Available commands are \\"data-set, local-file, stdin, uss-file\\".
Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: blah
"
`;
exports[`zos-jobs submit local-file command syntax errors should occur if the local file name is missing 1`] = `
"
Syntax Error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ describe("zos-jobs submit local-file command", () => {
TEST_ENVIRONMENT, [relDirname + "/testFileOfLocalJCL.txt"]);
expect(response.status).toBe(1);
expect(response.stdout.toString()).toBe("");
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stderr.toString()).toContain("Unknown argument: blah");
expect(response.stderr.toString()).toContain("Command failed due to improper syntax");
expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit local-file ' +
'../../../../packages/cli/__tests__/zosjobs/__integration__/submit/local-file/testFileOfLocalJCL.txt blah"');
expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".');
expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.');
});

it("should occur if --wfa and --directory are both specified", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,6 @@ exports[`zos-jobs submit uss-file command should display the help 1`] = `
}"
`;
exports[`zos-jobs submit uss-file command syntax errors should occur if an extra unknown option is specified 1`] = `
"Command Error:
Unknown argument: blah
Command failed due to improper syntax
Command entered: \\"zos-jobs submit uss-file /a/ibmuser/ussfile.txt blah\\"
Available commands are \\"data-set, local-file, stdin, uss-file\\".
Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options.
Error Details:
Unknown argument: blah
"
`;
exports[`zos-jobs submit uss-file command syntax errors should occur if both --wait-for-active and --directory is specified 1`] = `
"
Syntax Error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ describe("zos-jobs submit uss-file command", () => {
const response = runCliScript(__dirname + "/__scripts__/submit_syntax_invalid_parm.sh", TEST_ENVIRONMENT);
expect(response.status).toBe(1);
expect(response.stdout.toString()).toBe("");
expect(response.stderr.toString()).toMatchSnapshot();
expect(response.stderr.toString()).toContain("Unknown argument: blah");
expect(response.stderr.toString()).toContain("Command failed due to improper syntax");
expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit uss-file ' +
'/a/ibmuser/ussfile.txt blah"');
expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".');
expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.');
});

it("should occur if both --wait-for-active and --directory is specified", () => {
Expand Down
Loading

0 comments on commit 819985f

Please sign in to comment.