@sifurai/cli 0.1.1 → 0.1.2

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/accept.js CHANGED
@@ -151,7 +151,16 @@ export async function runCases(acceptance, options, deps) {
151
151
  const notes = [];
152
152
  let steps = [];
153
153
  let output;
154
- if (testCase.check === 'ui' || testCase.check === 'both') {
154
+ const withoutLogin = secretUses([testCase])
155
+ .map((use) => use.name)
156
+ .filter((name) => secrets[name] === undefined);
157
+ if ((testCase.check === 'ui' || testCase.check === 'both') && withoutLogin.length > 0) {
158
+ const note = `Not run: no ${withoutLogin.join(' or ')} was given.`;
159
+ io.out(` skipped: ${note}`);
160
+ statuses.push('skipped');
161
+ notes.push(note);
162
+ }
163
+ else if (testCase.check === 'ui' || testCase.check === 'both') {
155
164
  if (scripted.includes(testCase)) {
156
165
  browser ??= await (deps.launch ?? launchBrowser)({ headed: options.headed });
157
166
  const ui = await runUiCase(browser, testCase, {
@@ -284,7 +293,7 @@ export function printSummary(io, results) {
284
293
  for (const result of results)
285
294
  io.out(` ${result.status.padEnd(7)} ${result.id}`);
286
295
  const overall = outcome(results);
287
- const counts = ['passed', 'failed', 'blocked']
296
+ const counts = ['passed', 'failed', 'blocked', 'skipped']
288
297
  .map((status) => [status, results.filter((r) => r.status === status).length])
289
298
  .filter(([, count]) => count > 0)
290
299
  .map(([status, count]) => `${count} ${status}`);
package/dist/results.js CHANGED
@@ -25,8 +25,12 @@ export function combine(statuses) {
25
25
  return 'failed';
26
26
  if (statuses.includes('blocked'))
27
27
  return 'blocked';
28
+ if (statuses.length > 0 && statuses.every((status) => status === 'skipped'))
29
+ return 'skipped';
28
30
  return 'passed';
29
31
  }
32
+ /** Judged on the cases that ran, as Sifur judges it: a run where nothing ran proves nothing. */
30
33
  export function outcome(results) {
31
- return combine(results.map((result) => result.status));
34
+ const ran = results.filter((result) => result.status !== 'skipped');
35
+ return ran.length === 0 ? 'skipped' : combine(ran.map((result) => result.status));
32
36
  }
package/dist/secrets.js CHANGED
@@ -47,8 +47,11 @@ export async function collectSecrets(uses, io, env = process.env) {
47
47
  continue;
48
48
  }
49
49
  io.out(`${caseId} uses {{${name}}} in step ${step}${caption ? ` (${caption})` : ''}.`);
50
- const prompt = `${name} (or set SIFUR_SECRET_${name}): `;
51
- secrets[name] = ECHOED.test(name) && !HIDDEN.test(name) ? await io.ask(prompt) : await io.askHidden(prompt);
50
+ const prompt = `${name} (or set SIFUR_SECRET_${name}; Enter to skip the cases that need it): `;
51
+ const value = ECHOED.test(name) && !HIDDEN.test(name) ? await io.ask(prompt) : await io.askHidden(prompt);
52
+ // Left out: the cases that need it are skipped, never run with a blank login.
53
+ if (value !== '')
54
+ secrets[name] = value;
52
55
  }
53
56
  return secrets;
54
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sifurai/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Run a Sifur ticket's acceptance cases against your own test server and upload the results.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://sifur.ai",