@beryl-so/cli 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/runs.js +19 -11
- package/package.json +1 -1
package/dist/commands/runs.js
CHANGED
|
@@ -59,9 +59,10 @@ export const runCommands = [
|
|
|
59
59
|
{ name: "test", type: "strings", description: "Run only these test ids (repeatable)" },
|
|
60
60
|
{
|
|
61
61
|
name: "group",
|
|
62
|
-
type: "
|
|
63
|
-
description: "Run only the active tests in
|
|
64
|
-
"so the run records exactly what it ran.
|
|
62
|
+
type: "strings",
|
|
63
|
+
description: "Run only the active tests in these groups (by name, repeatable, union of members), " +
|
|
64
|
+
"resolved to ids before the run so the run records exactly what it ran. " +
|
|
65
|
+
"Cannot be combined with --test.",
|
|
65
66
|
},
|
|
66
67
|
{ name: "env", type: "string", description: "Environment id to run against" },
|
|
67
68
|
{ name: "url-override", type: "string", description: "Replace the base URL (preview deploys)" },
|
|
@@ -84,21 +85,28 @@ export const runCommands = [
|
|
|
84
85
|
"beryl runs trigger --url-override https://preview-123.example.com --watch --timeout 30",
|
|
85
86
|
"beryl runs trigger --url-override https://preview-123.example.com --header x-vercel-protection-bypass=<token> --watch",
|
|
86
87
|
"beryl runs trigger --test 4f… --test 9a…",
|
|
87
|
-
"beryl runs trigger --group Smoke --watch",
|
|
88
|
+
"beryl runs trigger --group Smoke --group Checkout --watch",
|
|
88
89
|
"beryl runs trigger --retries 0 --watch",
|
|
89
90
|
],
|
|
90
91
|
async run(ctx, input) {
|
|
91
92
|
const { workspaceId, projectId } = await ctx.requireProject(input);
|
|
92
93
|
let tests = input.flags.test;
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
94
|
+
const groups = input.flags.group;
|
|
95
|
+
if (groups && groups.length > 0 && tests && tests.length > 0)
|
|
95
96
|
throw new UsageError("--group cannot be combined with --test");
|
|
96
|
-
if (
|
|
97
|
+
if (groups && groups.length > 0) {
|
|
97
98
|
const listed = (await ctx.client.get(`${projectPath(workspaceId, projectId)}/tests`));
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const union = new Set();
|
|
100
|
+
for (const group of groups) {
|
|
101
|
+
const ids = idsInGroup(listed, group);
|
|
102
|
+
// Exiting 0 here would be a green CI run that tested nothing (or a typo'd
|
|
103
|
+
// group silently narrowing the run).
|
|
104
|
+
if (ids.length === 0)
|
|
105
|
+
throw new UsageError(`No active tests in group '${group}'.`);
|
|
106
|
+
for (const id of ids)
|
|
107
|
+
union.add(id);
|
|
108
|
+
}
|
|
109
|
+
tests = [...union];
|
|
102
110
|
}
|
|
103
111
|
const extraHeaders = parseHeaders(input.flags.header);
|
|
104
112
|
const created = (await ctx.client.post(`${projectPath(workspaceId, projectId)}/runs`, {
|
package/package.json
CHANGED