sedum-cli 0.1.0-alpha.0 → 0.1.0-alpha.11
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/README.md +64 -0
- package/dist/affected-selection-WV5WY5NQ.js +392 -0
- package/dist/chunk-AWBC7NOM.js +132 -0
- package/dist/{chunk-BEV24G7S.js → chunk-EFRMSNBD.js} +37 -171
- package/dist/{chunk-TZGSCV23.js → chunk-FAGJCNV7.js} +253 -16
- package/dist/{chunk-TU5MIKGA.js → chunk-HT6BIET2.js} +515 -188
- package/dist/{chunk-OB6ZUJ6X.js → chunk-HXQDSNLL.js} +83 -22
- package/dist/chunk-S7OB3JEF.js +208 -0
- package/dist/cli.js +31 -5
- package/dist/{doctor-command-2PMOA32Y.js → doctor-command-F4Y5KW36.js} +2 -2
- package/dist/index.d.ts +57 -11
- package/dist/index.js +11 -4
- package/dist/{init-command-54R2FQ2U.js → init-command-62IUO5LA.js} +38 -20
- package/dist/run-command-ZEIANJWZ.js +1605 -0
- package/package.json +23 -4
- package/dist/run-command-VAVFPCWG.js +0 -1269
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
browserAvailable,
|
|
3
3
|
keyPresent,
|
|
4
4
|
supportedNode
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HXQDSNLL.js";
|
|
6
6
|
import {
|
|
7
7
|
ProjectConfigError,
|
|
8
8
|
loadProjectConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FAGJCNV7.js";
|
|
10
10
|
|
|
11
11
|
// src/init-command.ts
|
|
12
12
|
import { constants } from "fs";
|
|
@@ -19,23 +19,36 @@ browser: chromium
|
|
|
19
19
|
outputDir: .sedum/runs
|
|
20
20
|
reporterDir: .sedum/reports
|
|
21
21
|
`;
|
|
22
|
-
var EXAMPLE = `
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
var EXAMPLE = `import { test, secret } from "sedum-cli";
|
|
23
|
+
|
|
24
|
+
test(
|
|
25
|
+
"a customer signs in to the SauceDemo sample store",
|
|
26
|
+
{ url: "https://www.saucedemo.com/" },
|
|
27
|
+
async ({ ai, env }) => {
|
|
28
|
+
await ai("type {{user}} in the username field", { user: "standard_user" });
|
|
29
|
+
await ai("type {{password}} in the password field", {
|
|
30
|
+
password: secret(env.SAUCE_PASSWORD ?? ""),
|
|
31
|
+
});
|
|
32
|
+
await ai("click the login button");
|
|
33
|
+
await ai("verify a list of products with prices is shown");
|
|
34
|
+
},
|
|
35
|
+
);
|
|
32
36
|
`;
|
|
33
37
|
var ENV_EXAMPLE = `# Get a TypeSafe key and put it in .env, or set it in your shell.
|
|
38
|
+
# For a compatible provider, also set TYPESAFE_BASE_URL and optionally TYPESAFE_DEFAULT_MODEL.
|
|
34
39
|
TYPESAFE_API_KEY=
|
|
40
|
+
# If provider.name is clef, use these instead (never commit .env).
|
|
41
|
+
# CLOUDFLARE_ACCOUNT_ID=
|
|
42
|
+
# CLOUDFLARE_AUTH_TOKEN=
|
|
35
43
|
# Public SauceDemo sample account; no Sauce Labs account is required.
|
|
36
44
|
SAUCE_PASSWORD=secret_sauce
|
|
37
45
|
`;
|
|
38
|
-
var IGNORE = [
|
|
46
|
+
var IGNORE = [
|
|
47
|
+
"node_modules/",
|
|
48
|
+
".env",
|
|
49
|
+
".sedum/runs/",
|
|
50
|
+
".sedum/reports/"
|
|
51
|
+
];
|
|
39
52
|
var WORDMARK = [
|
|
40
53
|
" \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588 \u2588",
|
|
41
54
|
"\u2588 \u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588 \u2588\u2591 \u2588\u2591\u2588\u2588 \u2588\u2588\u2591 \u2588\u2591\u2591\u2591\u2588 \u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2591 \u2588\u2591",
|
|
@@ -152,12 +165,12 @@ async function executeInitCommand(options) {
|
|
|
152
165
|
await regularDirectory(path.join(root, "tests"));
|
|
153
166
|
for (const [name, contents] of [
|
|
154
167
|
["sedum.config.yaml", CONFIG],
|
|
155
|
-
["tests/example.test.
|
|
168
|
+
["tests/example.test.ts", EXAMPLE],
|
|
156
169
|
[".env.example", ENV_EXAMPLE]
|
|
157
170
|
]) {
|
|
158
171
|
const result = await createOrKeep(path.join(root, name), contents);
|
|
159
172
|
if (name === ".env.example" && result === "kept") keptEnvExample = true;
|
|
160
|
-
if (name === "tests/example.test.
|
|
173
|
+
if (name === "tests/example.test.ts" && result === "created")
|
|
161
174
|
createdExample = true;
|
|
162
175
|
say(`${result} ${name}
|
|
163
176
|
`);
|
|
@@ -165,7 +178,7 @@ async function executeInitCommand(options) {
|
|
|
165
178
|
say(await updateIgnore(root, options));
|
|
166
179
|
say("\nSedum runs plain-language tests in a browser.\n");
|
|
167
180
|
if (createdExample) {
|
|
168
|
-
const title = "\u2500\u2500 tests/example.test.
|
|
181
|
+
const title = "\u2500\u2500 tests/example.test.ts ";
|
|
169
182
|
const divider = "\u2500".repeat(54);
|
|
170
183
|
say(`
|
|
171
184
|
${title}${divider.slice(title.length)}
|
|
@@ -189,10 +202,15 @@ ${++step}. ${title}
|
|
|
189
202
|
const hasBrowser = (options.browser ?? browserAvailable)(config.browser);
|
|
190
203
|
const hasEnv = await pathExists(path.join(root, ".env"));
|
|
191
204
|
if (!keyPresent(config))
|
|
192
|
-
next("Add
|
|
193
|
-
"Get a key at https://typesafe.ai/.",
|
|
205
|
+
next("Add a provider API key", [
|
|
206
|
+
...config.providerName === "clef" ? ["Create a scoped Workers AI token in the Cloudflare dashboard."] : ["Get a key at https://typesafe.ai/."],
|
|
194
207
|
...hasEnv ? [] : ["cp .env.example .env"],
|
|
195
|
-
|
|
208
|
+
...config.providerName === "clef" ? [
|
|
209
|
+
"Open .env and set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN (or set them in your shell)."
|
|
210
|
+
] : [
|
|
211
|
+
"Open .env and set TYPESAFE_API_KEY to your key (or set it in your shell).",
|
|
212
|
+
"For a compatible provider, also set TYPESAFE_BASE_URL and use that provider's key as TYPESAFE_API_KEY."
|
|
213
|
+
]
|
|
196
214
|
]);
|
|
197
215
|
if (!hasBrowser)
|
|
198
216
|
next(
|
|
@@ -217,7 +235,7 @@ ${++step}. ${title}
|
|
|
217
235
|
]);
|
|
218
236
|
}
|
|
219
237
|
next("Run the example", [
|
|
220
|
-
"sedum run tests/example.test.
|
|
238
|
+
"sedum run tests/example.test.ts --headed",
|
|
221
239
|
"This calls the TypeSafe API and may incur a charge."
|
|
222
240
|
]);
|
|
223
241
|
return { stdout: output.join(""), stderr: "", exitCode: 0 };
|