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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): fix --token usage in CLI #56

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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