Skip to content

Commit

Permalink
fix(cli): fix --token usage in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Sep 10, 2023
1 parent 75d2c0c commit 673dda3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ program
const spinner = ora("Uploading screenshots").start();
try {
const result = await upload({
token: options.token,
root: directory,
buildName: options.buildName,
files: options.files,
Expand Down
11 changes: 11 additions & 0 deletions packages/core/src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ describe("#createConfig", () => {
it("throws with invalid commit", () => {
expect(() => createConfig().validate()).toThrow("commit: Invalid commit");
});

it("throws with invalid token", () => {
const config = createConfig();
config.load({
commit: "f16f980bd17cccfa93a1ae7766727e67950773d0",
token: "invalid",
});
expect(() => config.validate()).toThrow(
"token: Invalid Argos repository token (must be 40 characters)",
);
});
});
2 changes: 1 addition & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mustBeCommit = (value: any) => {

const mustBeArgosToken = (value: any) => {
if (value && value.length !== 40) {
throw new Error("Must be a valid Argos repository token");
throw new Error("Invalid Argos repository token (must be 40 characters)");
}
};

Expand Down

0 comments on commit 673dda3

Please sign in to comment.