Skip to content

Commit b05dff3

Browse files
authored
Merge pull request #56 from argos-ci/52-support-token-from-command-line
fix(cli): fix --token usage in CLI
2 parents 75d2c0c + 673dda3 commit b05dff3

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/cli/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ program
4545
const spinner = ora("Uploading screenshots").start();
4646
try {
4747
const result = await upload({
48+
token: options.token,
4849
root: directory,
4950
buildName: options.buildName,
5051
files: options.files,

packages/core/src/config.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ describe("#createConfig", () => {
2727
it("throws with invalid commit", () => {
2828
expect(() => createConfig().validate()).toThrow("commit: Invalid commit");
2929
});
30+
31+
it("throws with invalid token", () => {
32+
const config = createConfig();
33+
config.load({
34+
commit: "f16f980bd17cccfa93a1ae7766727e67950773d0",
35+
token: "invalid",
36+
});
37+
expect(() => config.validate()).toThrow(
38+
"token: Invalid Argos repository token (must be 40 characters)",
39+
);
40+
});
3041
});

packages/core/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const mustBeCommit = (value: any) => {
2323

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

0 commit comments

Comments
 (0)