quiesco 0.1.1 → 0.3.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/README.md +3 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.d.ts +21 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +142 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +12 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +8 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts +16 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +56 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/test.d.ts +28 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +72 -9
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/ui.d.ts +43 -0
- package/dist/commands/ui.d.ts.map +1 -0
- package/dist/commands/ui.js +121 -0
- package/dist/commands/ui.js.map +1 -0
- package/dist/context.d.ts +43 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +85 -0
- package/dist/context.js.map +1 -1
- package/dist/dev-server.d.ts +17 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +83 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/progress/render.d.ts +31 -0
- package/dist/progress/render.d.ts.map +1 -0
- package/dist/progress/render.js +89 -0
- package/dist/progress/render.js.map +1 -0
- package/dist/progress/run.d.ts +24 -0
- package/dist/progress/run.d.ts.map +1 -0
- package/dist/progress/run.js +95 -0
- package/dist/progress/run.js.map +1 -0
- package/dist/progress/sticky.d.ts +25 -0
- package/dist/progress/sticky.d.ts.map +1 -0
- package/dist/progress/sticky.js +90 -0
- package/dist/progress/sticky.js.map +1 -0
- package/package.json +3 -3
- package/src/cli.ts +16 -1
- package/src/commands/build.ts +152 -0
- package/src/commands/doctor.ts +12 -2
- package/src/commands/init.ts +9 -7
- package/src/commands/list.ts +65 -0
- package/src/commands/test.ts +83 -10
- package/src/commands/ui.ts +152 -0
- package/src/context.ts +114 -0
- package/src/dev-server.ts +91 -0
- package/src/progress/render.ts +117 -0
- package/src/progress/run.ts +105 -0
- package/src/progress/sticky.ts +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAqB,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/E,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAIrD,gGAAgG;AAChG,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAIxF;AAED,qFAAqF;AACrF,wBAAsB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGjF;AAED,MAAM,WAAW,SAAS;IACxB,+DAA+D;IAC/D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAID;;;GAGG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAgCvH"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Metro dev server for `quiesco test` (issue #5), like Playwright's `webServer`: when the app loads its JS
|
|
3
|
+
* from Metro (`devClient.metroUrl` on iOS / Android, `apps.web.url` on the web) and nothing answers there,
|
|
4
|
+
* start `expo start` with EXPO_PUBLIC_QUIESCO=1, wait until it is ready, and stop it when the run ends. A
|
|
5
|
+
* Metro that is already running is used as it is. Here, in the CLI, because it is the one process of the run:
|
|
6
|
+
* parallel workers (cucumber-js child processes, Jest workers) would each start and stop their own.
|
|
7
|
+
*/
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
export const DEFAULT_DEV_SERVER_TIMEOUT_MS = 120_000;
|
|
10
|
+
const POLL_MS = 500;
|
|
11
|
+
const DEFAULT_METRO_URL = 'http://localhost:8081';
|
|
12
|
+
/** Where the app loads its JS from on `platform`, or null when it does not use a dev server. */
|
|
13
|
+
export function devServerUrl(config, platform) {
|
|
14
|
+
if (platform === 'web')
|
|
15
|
+
return config.apps.web?.url ?? null;
|
|
16
|
+
const dc = config.apps[platform]?.devClient;
|
|
17
|
+
return dc === undefined ? null : (dc.metroUrl ?? DEFAULT_METRO_URL);
|
|
18
|
+
}
|
|
19
|
+
/** Whether Metro answers at `url` (its `/status` says `packager-status:running`). */
|
|
20
|
+
export async function metroRunning(ctx, url) {
|
|
21
|
+
const r = await ctx.httpGet(new URL('/status', url).toString(), 2000);
|
|
22
|
+
return r !== null && r.body.includes('packager-status:running');
|
|
23
|
+
}
|
|
24
|
+
const NOTHING = { stop: async () => { } };
|
|
25
|
+
/**
|
|
26
|
+
* Make sure the dev server the app needs is running. Returns how to stop what was started. Throws when it
|
|
27
|
+
* was started but did not become ready (with the end of its log).
|
|
28
|
+
*/
|
|
29
|
+
export async function ensureDevServer(ctx, config, platform) {
|
|
30
|
+
const url = devServerUrl(config, platform);
|
|
31
|
+
if (url === null)
|
|
32
|
+
return NOTHING;
|
|
33
|
+
if (await metroRunning(ctx, url)) {
|
|
34
|
+
ctx.out(`quiesco: using the Metro dev server at ${url}`);
|
|
35
|
+
return NOTHING;
|
|
36
|
+
}
|
|
37
|
+
const opts = config.devServer ?? {};
|
|
38
|
+
const where = new URL(url);
|
|
39
|
+
if (opts.autoStart === false || !['localhost', '127.0.0.1', '[::1]'].includes(where.hostname)) {
|
|
40
|
+
ctx.out(`quiesco: nothing answers at ${url}; start Metro there (EXPO_PUBLIC_QUIESCO=1 npx expo start) — ${opts.autoStart === false ? 'devServer.autoStart is false' : 'it is not on this machine'}`);
|
|
41
|
+
return NOTHING;
|
|
42
|
+
}
|
|
43
|
+
const port = where.port !== '' ? where.port : where.protocol === 'https:' ? '443' : '80';
|
|
44
|
+
const [command, ...args] = (opts.command ?? ['npx', 'expo', 'start', '--port', '{port}']).map((a) => a.replaceAll('{port}', port));
|
|
45
|
+
if (command === undefined)
|
|
46
|
+
throw new Error('devServer.command is empty');
|
|
47
|
+
const logFile = path.join(ctx.cwd, config.artifacts?.dir ?? 'artifacts', 'metro.log');
|
|
48
|
+
ctx.out(`quiesco: starting Metro (${[command, ...args].join(' ')}) with EXPO_PUBLIC_QUIESCO=1; log: ${path.relative(ctx.cwd, logFile)}`);
|
|
49
|
+
const proc = ctx.spawnBackground(command, args, { cwd: ctx.cwd, env: { ...ctx.env, EXPO_PUBLIC_QUIESCO: '1' }, logFile });
|
|
50
|
+
const offInterrupt = ctx.onInterrupt(() => proc.stop());
|
|
51
|
+
const server = {
|
|
52
|
+
stop: async () => {
|
|
53
|
+
offInterrupt();
|
|
54
|
+
await proc.stop();
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
await waitReady(ctx, url, proc, opts.timeoutMs ?? DEFAULT_DEV_SERVER_TIMEOUT_MS, logFile).catch(async (e) => {
|
|
58
|
+
await server.stop();
|
|
59
|
+
throw e;
|
|
60
|
+
});
|
|
61
|
+
ctx.out(`quiesco: Metro is ready at ${url}`);
|
|
62
|
+
return server;
|
|
63
|
+
}
|
|
64
|
+
async function waitReady(ctx, url, proc, timeoutMs, logFile) {
|
|
65
|
+
let exitCode = null;
|
|
66
|
+
void proc.exited.then((c) => (exitCode = c));
|
|
67
|
+
for (let waited = 0;; waited += POLL_MS) {
|
|
68
|
+
if (await metroRunning(ctx, url))
|
|
69
|
+
return;
|
|
70
|
+
if (exitCode !== null)
|
|
71
|
+
throw new Error(`Metro exited (code ${exitCode}) before it was ready.${tail(ctx, logFile)}`);
|
|
72
|
+
if (waited >= timeoutMs)
|
|
73
|
+
throw new Error(`Metro was not ready at ${url} within ${timeoutMs}ms (devServer.timeoutMs).${tail(ctx, logFile)}`);
|
|
74
|
+
await ctx.sleep(POLL_MS);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function tail(ctx, logFile) {
|
|
78
|
+
const text = ctx.readFile(logFile);
|
|
79
|
+
if (text === null || text.trim() === '')
|
|
80
|
+
return '';
|
|
81
|
+
return `\nLast lines of ${logFile}:\n${text.trimEnd().split('\n').slice(-15).join('\n')}`;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=dev-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC;AACrD,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAElD,gGAAgG;AAChG,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,QAAqB;IACvE,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC;IAC5D,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC5C,OAAO,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,iBAAiB,CAAC,CAAC;AACtE,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAe,EAAE,GAAW;IAC7D,MAAM,CAAC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C,CAAC;IACnC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IACnD,OAAO,mBAAmB,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The progress bar line of `quiesco test`, from a RunState. Pure (no terminal access) so it can be
|
|
3
|
+
* unit-tested:
|
|
4
|
+
*
|
|
5
|
+
* ▕██████████░░░░░░░░░░▏ 12/30 ✓10 ✗1 ↷1 2m13s ▶ adds a todo
|
|
6
|
+
*
|
|
7
|
+
* - `~30`: the total is an estimate (Vitest) or still growing (Jest).
|
|
8
|
+
* - Several workers: `▶ 1:adds a todo · 2:edits a todo` (worker numbers from 1).
|
|
9
|
+
* - Fits in `width` columns (CJK characters count as two).
|
|
10
|
+
*/
|
|
11
|
+
import type { RunState } from '@quiesco/core';
|
|
12
|
+
export interface RenderOptions {
|
|
13
|
+
width: number;
|
|
14
|
+
color: boolean;
|
|
15
|
+
/** Bar cells (default 20). */
|
|
16
|
+
barWidth?: number;
|
|
17
|
+
/**
|
|
18
|
+
* When the runner was started (epoch ms): the time shown counts from there, so it includes starting the
|
|
19
|
+
* device and the app. Default: from the first test.
|
|
20
|
+
*/
|
|
21
|
+
since?: number;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
}
|
|
24
|
+
export declare function stripAnsi(text: string): string;
|
|
25
|
+
/** Terminal columns taken by `text` (ANSI escapes take none). */
|
|
26
|
+
export declare function textWidth(text: string): number;
|
|
27
|
+
/** Cut plain text (no ANSI) to `width` columns, ending with … when cut. */
|
|
28
|
+
export declare function truncate(text: string, width: number): string;
|
|
29
|
+
export declare function formatDuration(ms: number): string;
|
|
30
|
+
export declare function renderBar(state: RunState, options: RenderOptions): string;
|
|
31
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/progress/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAKD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAiBD,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ9C;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAY5D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAMjD;AAID,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAiCzE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// eslint-disable-next-line no-control-regex -- ANSI escape sequences start with ESC
|
|
2
|
+
const ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]/g;
|
|
3
|
+
export function stripAnsi(text) {
|
|
4
|
+
return text.replace(ANSI, '');
|
|
5
|
+
}
|
|
6
|
+
/** East Asian wide and fullwidth characters, and emoji, take two columns. */
|
|
7
|
+
function isWide(code) {
|
|
8
|
+
return ((code >= 0x1100 && code <= 0x115f) ||
|
|
9
|
+
(code >= 0x2e80 && code <= 0xa4cf && code !== 0x303f) ||
|
|
10
|
+
(code >= 0xac00 && code <= 0xd7a3) ||
|
|
11
|
+
(code >= 0xf900 && code <= 0xfaff) ||
|
|
12
|
+
(code >= 0xfe30 && code <= 0xfe4f) ||
|
|
13
|
+
(code >= 0xff00 && code <= 0xff60) ||
|
|
14
|
+
(code >= 0xffe0 && code <= 0xffe6) ||
|
|
15
|
+
(code >= 0x1f300 && code <= 0x1faff) ||
|
|
16
|
+
(code >= 0x20000 && code <= 0x3fffd));
|
|
17
|
+
}
|
|
18
|
+
/** Terminal columns taken by `text` (ANSI escapes take none). */
|
|
19
|
+
export function textWidth(text) {
|
|
20
|
+
let w = 0;
|
|
21
|
+
for (const ch of stripAnsi(text)) {
|
|
22
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
23
|
+
if (code < 0x20 || (code >= 0x7f && code < 0xa0) || (code >= 0x300 && code <= 0x36f) || code === 0x200d || (code >= 0xfe00 && code <= 0xfe0f))
|
|
24
|
+
continue;
|
|
25
|
+
w += isWide(code) ? 2 : 1;
|
|
26
|
+
}
|
|
27
|
+
return w;
|
|
28
|
+
}
|
|
29
|
+
/** Cut plain text (no ANSI) to `width` columns, ending with … when cut. */
|
|
30
|
+
export function truncate(text, width) {
|
|
31
|
+
if (width <= 0)
|
|
32
|
+
return '';
|
|
33
|
+
if (textWidth(text) <= width)
|
|
34
|
+
return text;
|
|
35
|
+
let out = '';
|
|
36
|
+
let w = 0;
|
|
37
|
+
for (const ch of text) {
|
|
38
|
+
const cw = textWidth(ch);
|
|
39
|
+
if (w + cw > width - 1)
|
|
40
|
+
break;
|
|
41
|
+
out += ch;
|
|
42
|
+
w += cw;
|
|
43
|
+
}
|
|
44
|
+
return `${out}…`;
|
|
45
|
+
}
|
|
46
|
+
export function formatDuration(ms) {
|
|
47
|
+
const s = Math.floor(ms / 1000);
|
|
48
|
+
if (s < 60)
|
|
49
|
+
return `${s}s`;
|
|
50
|
+
const m = Math.floor(s / 60);
|
|
51
|
+
if (m < 60)
|
|
52
|
+
return `${m}m${String(s % 60).padStart(2, '0')}s`;
|
|
53
|
+
return `${Math.floor(m / 60)}h${String(m % 60).padStart(2, '0')}m`;
|
|
54
|
+
}
|
|
55
|
+
const paint = (on, code, text) => (on ? `\u001b[${code}m${text}\u001b[0m` : text);
|
|
56
|
+
export function renderBar(state, options) {
|
|
57
|
+
const { width, color } = options;
|
|
58
|
+
const cells = options.barWidth ?? 20;
|
|
59
|
+
if (state.phase === 'idle')
|
|
60
|
+
return truncate('quiesco: waiting for the test runner…', width - 1);
|
|
61
|
+
const total = state.total;
|
|
62
|
+
const done = state.done;
|
|
63
|
+
const ratio = total > 0 ? Math.min(1, done / total) : 0;
|
|
64
|
+
const filled = Math.round(ratio * cells);
|
|
65
|
+
const failed = state.counts.failed > 0 || state.fileErrors.size > 0 || state.runErrors.length > 0;
|
|
66
|
+
const bar = `▕${paint(color, failed ? '31' : '32', '█'.repeat(filled))}${paint(color, '2', '░'.repeat(cells - filled))}▏`;
|
|
67
|
+
const totalText = `${state.totalIsApproximate ? '~' : ''}${total}`;
|
|
68
|
+
const c = state.counts;
|
|
69
|
+
const skipped = c.skipped + c.pending + c.todo + c.undefined + c.notRun;
|
|
70
|
+
const parts = [
|
|
71
|
+
`${bar} ${done}/${totalText}`,
|
|
72
|
+
[paint(color, '32', `✓${c.passed}`), ...(c.failed > 0 ? [paint(color, '31', `✗${c.failed}`)] : []), ...(skipped > 0 ? [paint(color, '33', `↷${skipped}`)] : [])].join(' '),
|
|
73
|
+
formatDuration(options.since !== undefined ? Math.max(0, (state.endedAt ?? (options.now ?? Date.now)()) - options.since) : state.elapsedMs),
|
|
74
|
+
];
|
|
75
|
+
let line = parts.join(' ');
|
|
76
|
+
// What is running now, in the space left.
|
|
77
|
+
const room = width - 1 - textWidth(line) - 4;
|
|
78
|
+
if (state.phase === 'running' && state.running.size > 0 && room > 8) {
|
|
79
|
+
const running = [...state.running.values()].sort((a, b) => (a.worker ?? 0) - (b.worker ?? 0));
|
|
80
|
+
const many = running.length > 1;
|
|
81
|
+
const text = running.map((r) => `${many && r.worker !== undefined ? `${r.worker + 1}:` : ''}${r.test.name}`).join(' · ');
|
|
82
|
+
line += ` ${paint(color, '36', '▶')} ${truncate(text, room)}`;
|
|
83
|
+
}
|
|
84
|
+
else if (state.phase === 'ended') {
|
|
85
|
+
line += ` ${state.interrupted ? paint(color, '33', 'interrupted') : state.success === true ? paint(color, '32', 'passed') : paint(color, '31', 'failed')}`;
|
|
86
|
+
}
|
|
87
|
+
return textWidth(line) <= width - 1 ? line : truncate(stripAnsi(line), width - 1);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/progress/render.ts"],"names":[],"mappings":"AAyBA,oFAAoF;AACpF,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAE5C,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,6EAA6E;AAC7E,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,CACL,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,KAAK,MAAM,CAAC;QACrD,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAClC,CAAC,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,C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C,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzH,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;IACjE,CAAC;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;QACnC,IAAI,IAAI,KAAK,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;IAC9J,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CliContext, Terminal } from '../context.js';
|
|
2
|
+
export type RunnerName = 'cucumber' | 'jest' | 'vitest';
|
|
3
|
+
/**
|
|
4
|
+
* Whether to show the bar: a terminal, not CI, not turned off (`--no-progress`, QUIESCO_PROGRESS=0).
|
|
5
|
+
*/
|
|
6
|
+
export declare function progressWanted(ctx: CliContext, noProgressFlag: boolean): ctx is CliContext & {
|
|
7
|
+
terminal: Terminal;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The cucumber-js arguments that add Quiesco's events formatter, from the project's own
|
|
11
|
+
* @quiesco/cucumber; [] when it is not installed. The file target keeps the user's stdout formatter
|
|
12
|
+
* (a format without one would replace it).
|
|
13
|
+
*/
|
|
14
|
+
export declare function cucumberFormatArgs(ctx: CliContext): string[];
|
|
15
|
+
export interface ProgressRun {
|
|
16
|
+
command: string;
|
|
17
|
+
args: readonly string[];
|
|
18
|
+
env: NodeJS.ProcessEnv;
|
|
19
|
+
runner: RunnerName;
|
|
20
|
+
}
|
|
21
|
+
export declare function runWithProgress(ctx: CliContext & {
|
|
22
|
+
terminal: Terminal;
|
|
23
|
+
}, run: ProgressRun): Promise<number>;
|
|
24
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/progress/run.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI1D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAKxD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAMnH;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAS5D;AAQD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA6CjH"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the test runner with the progress bar (P3): a run-events socket the runner's Quiesco reporter
|
|
3
|
+
* connects to (QUIESCO_EVENTS), the runner's output piped through so the bar stays on the last line.
|
|
4
|
+
*/
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import { RunEventServer, RunState } from '@quiesco/core';
|
|
9
|
+
import { renderBar } from './render.js';
|
|
10
|
+
import { StickyTerminal } from './sticky.js';
|
|
11
|
+
/** Redraw at most this often for events; the clock ticks once a second. */
|
|
12
|
+
const FRAME_MS = 80;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to show the bar: a terminal, not CI, not turned off (`--no-progress`, QUIESCO_PROGRESS=0).
|
|
15
|
+
*/
|
|
16
|
+
export function progressWanted(ctx, noProgressFlag) {
|
|
17
|
+
if (noProgressFlag || ctx.terminal === null)
|
|
18
|
+
return false;
|
|
19
|
+
const env = ctx.env;
|
|
20
|
+
if (env['QUIESCO_PROGRESS'] === '0' || env['QUIESCO_PROGRESS'] === 'false')
|
|
21
|
+
return false;
|
|
22
|
+
const ci = env['CI'];
|
|
23
|
+
return ci === undefined || ci === '' || ci === '0' || ci === 'false';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The cucumber-js arguments that add Quiesco's events formatter, from the project's own
|
|
27
|
+
* @quiesco/cucumber; [] when it is not installed. The file target keeps the user's stdout formatter
|
|
28
|
+
* (a format without one would replace it).
|
|
29
|
+
*/
|
|
30
|
+
export function cucumberFormatArgs(ctx) {
|
|
31
|
+
const file = ctx.resolveFrom(ctx.cwd, '@quiesco/cucumber/events');
|
|
32
|
+
if (file === null)
|
|
33
|
+
return [];
|
|
34
|
+
const url = pathToFileURL(file).href;
|
|
35
|
+
// Windows: a temp file (cucumber creates the target's directory, which fails for the null device).
|
|
36
|
+
const target = ctx.platform === 'win32' ? path.join(os.tmpdir(), `quiesco-events-${process.pid}.out`) : '/dev/null';
|
|
37
|
+
const descriptor = `"${url}":"${target}"`;
|
|
38
|
+
// Through cmd.exe (Windows runs npx with a shell) the quotes must survive the argument parsing.
|
|
39
|
+
return ['--format', ctx.platform === 'win32' ? `"${descriptor.replaceAll('"', '\\"')}"` : descriptor];
|
|
40
|
+
}
|
|
41
|
+
const HINTS = {
|
|
42
|
+
cucumber: "quiesco: no test progress was received. Install @quiesco/cucumber in this project (quiesco test adds its formatter by itself).",
|
|
43
|
+
vitest: "quiesco: no test progress was received. Add quiescoPlugin() to your Vitest config: `import { quiesco, quiescoPlugin } from '@quiesco/vitest/config'` and `plugins: [quiescoPlugin()]`.",
|
|
44
|
+
jest: "quiesco: no test progress was received. Your Jest config replaces the preset's reporters: add '@quiesco/jest/reporter' to `reporters` (next to 'default').",
|
|
45
|
+
};
|
|
46
|
+
export async function runWithProgress(ctx, run) {
|
|
47
|
+
const term = ctx.terminal;
|
|
48
|
+
const state = new RunState();
|
|
49
|
+
const since = Date.now();
|
|
50
|
+
const sticky = new StickyTerminal({ write: term.stdout, columns: term.columns });
|
|
51
|
+
const draw = () => sticky.setBar(renderBar(state, { width: term.columns(), color: term.color, since }));
|
|
52
|
+
let frame = null;
|
|
53
|
+
const schedule = () => {
|
|
54
|
+
frame ??= setTimeout(() => {
|
|
55
|
+
frame = null;
|
|
56
|
+
draw();
|
|
57
|
+
}, FRAME_MS);
|
|
58
|
+
};
|
|
59
|
+
const server = new RunEventServer({
|
|
60
|
+
onEvent: (event) => {
|
|
61
|
+
state.apply(event);
|
|
62
|
+
schedule();
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
await server.listen();
|
|
66
|
+
const clock = setInterval(draw, 1000);
|
|
67
|
+
clock.unref();
|
|
68
|
+
const offInterrupt = term.onInterrupt(() => sticky.stop());
|
|
69
|
+
draw();
|
|
70
|
+
const env = { ...run.env, ...server.env() };
|
|
71
|
+
// The runner's output is a pipe now: keep its colors and width as on the terminal.
|
|
72
|
+
if (term.color && env['FORCE_COLOR'] === undefined && env['NO_COLOR'] === undefined)
|
|
73
|
+
env['FORCE_COLOR'] = '1';
|
|
74
|
+
if (env['COLUMNS'] === undefined)
|
|
75
|
+
env['COLUMNS'] = String(term.columns());
|
|
76
|
+
let code;
|
|
77
|
+
try {
|
|
78
|
+
code = await ctx.runPiped(run.command, run.args, { cwd: ctx.cwd, env, onStdout: (c) => sticky.output(c, term.stdout), onStderr: (c) => sticky.output(c, term.stderr) });
|
|
79
|
+
await server.drain();
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
clearInterval(clock);
|
|
83
|
+
if (frame !== null)
|
|
84
|
+
clearTimeout(frame);
|
|
85
|
+
offInterrupt();
|
|
86
|
+
await server.close();
|
|
87
|
+
}
|
|
88
|
+
state.runnerExited(code);
|
|
89
|
+
const received = server.hellos.length > 0;
|
|
90
|
+
sticky.stop(received ? renderBar(state, { width: term.columns(), color: term.color, since }) : undefined);
|
|
91
|
+
if (!received)
|
|
92
|
+
ctx.err(HINTS[run.runner]);
|
|
93
|
+
return code;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/progress/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7C,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAe,EAAE,cAAu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AM,GAAG,CAAC,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1G,IAAI,CAAC,QAAQ;QAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface StickyOutput {
|
|
2
|
+
/** Writes escape sequences and the bottom region (stdout). */
|
|
3
|
+
write(text: string): void;
|
|
4
|
+
/** Current terminal width. */
|
|
5
|
+
columns(): number;
|
|
6
|
+
}
|
|
7
|
+
export declare class StickyTerminal {
|
|
8
|
+
private readonly out;
|
|
9
|
+
private partial;
|
|
10
|
+
private bar;
|
|
11
|
+
private drawnRows;
|
|
12
|
+
private stopped;
|
|
13
|
+
constructor(out: StickyOutput);
|
|
14
|
+
/** The child wrote `chunk` (to stdout or stderr: `write` is that stream). */
|
|
15
|
+
output(chunk: string, write: (text: string) => void): void;
|
|
16
|
+
/** Show `line` as the status line (no wider than the terminal). */
|
|
17
|
+
setBar(line: string): void;
|
|
18
|
+
/** Remove the region; write the unfinished line back, then `finalLine` (if any) as plain output. */
|
|
19
|
+
stop(finalLine?: string): void;
|
|
20
|
+
private visiblePartial;
|
|
21
|
+
private rows;
|
|
22
|
+
private draw;
|
|
23
|
+
private erase;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sticky.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky.d.ts","sourceRoot":"","sources":["../../src/progress/sticky.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8BAA8B;IAC9B,OAAO,IAAI,MAAM,CAAC;CACnB;AAED,qBAAa,cAAc;IAMb,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAS;gBAEK,GAAG,EAAE,YAAY;IAE9C,6EAA6E;IAC7E,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAiB1D,mEAAmE;IACnE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO1B,oGAAoG;IACpG,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAU9B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,IAAI;IAeZ,OAAO,CAAC,KAAK;CAMd"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps one status line at the bottom of the terminal while a child's output scrolls above it.
|
|
3
|
+
*
|
|
4
|
+
* The bottom region is [the child's current unfinished line, if any] + [the status line]. Before the
|
|
5
|
+
* child's output is written the region is erased (cursor up, clear to the end of the screen); complete
|
|
6
|
+
* lines are written; the region is drawn again. An unfinished line (cucumber's progress dots
|
|
7
|
+
* `....F..`) stays visible above the bar and is completed in place by later output.
|
|
8
|
+
*/
|
|
9
|
+
import { textWidth } from './render.js';
|
|
10
|
+
export class StickyTerminal {
|
|
11
|
+
out;
|
|
12
|
+
partial = '';
|
|
13
|
+
bar = '';
|
|
14
|
+
drawnRows = 0;
|
|
15
|
+
stopped = false;
|
|
16
|
+
constructor(out) {
|
|
17
|
+
this.out = out;
|
|
18
|
+
}
|
|
19
|
+
/** The child wrote `chunk` (to stdout or stderr: `write` is that stream). */
|
|
20
|
+
output(chunk, write) {
|
|
21
|
+
if (this.stopped) {
|
|
22
|
+
write(chunk);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.erase();
|
|
26
|
+
const text = this.partial + chunk;
|
|
27
|
+
const nl = text.lastIndexOf('\n');
|
|
28
|
+
if (nl === -1) {
|
|
29
|
+
this.partial = text;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
write(text.slice(0, nl + 1));
|
|
33
|
+
this.partial = text.slice(nl + 1);
|
|
34
|
+
}
|
|
35
|
+
this.draw();
|
|
36
|
+
}
|
|
37
|
+
/** Show `line` as the status line (no wider than the terminal). */
|
|
38
|
+
setBar(line) {
|
|
39
|
+
if (this.stopped || line === this.bar)
|
|
40
|
+
return;
|
|
41
|
+
this.erase();
|
|
42
|
+
this.bar = line;
|
|
43
|
+
this.draw();
|
|
44
|
+
}
|
|
45
|
+
/** Remove the region; write the unfinished line back, then `finalLine` (if any) as plain output. */
|
|
46
|
+
stop(finalLine) {
|
|
47
|
+
if (this.stopped)
|
|
48
|
+
return;
|
|
49
|
+
this.erase();
|
|
50
|
+
this.stopped = true;
|
|
51
|
+
let tail = this.partial;
|
|
52
|
+
this.partial = '';
|
|
53
|
+
if (finalLine !== undefined)
|
|
54
|
+
tail += `${tail === '' ? '' : '\n'}${finalLine}\n`;
|
|
55
|
+
if (tail !== '')
|
|
56
|
+
this.out.write(tail);
|
|
57
|
+
}
|
|
58
|
+
visiblePartial() {
|
|
59
|
+
// A carriage return inside the unfinished line rewrites it from the start, as a terminal would.
|
|
60
|
+
const cr = this.partial.lastIndexOf('\r');
|
|
61
|
+
return cr === -1 ? this.partial : this.partial.slice(cr + 1);
|
|
62
|
+
}
|
|
63
|
+
rows(text) {
|
|
64
|
+
const cols = Math.max(1, this.out.columns());
|
|
65
|
+
return Math.max(1, Math.ceil(textWidth(text) / cols));
|
|
66
|
+
}
|
|
67
|
+
draw() {
|
|
68
|
+
const partial = this.visiblePartial();
|
|
69
|
+
if (partial === '' && this.bar === '')
|
|
70
|
+
return;
|
|
71
|
+
let text = '';
|
|
72
|
+
let rows = 0;
|
|
73
|
+
if (partial !== '') {
|
|
74
|
+
text += `${partial}\n`;
|
|
75
|
+
rows += this.rows(partial);
|
|
76
|
+
}
|
|
77
|
+
text += this.bar;
|
|
78
|
+
rows += 1;
|
|
79
|
+
this.out.write(text);
|
|
80
|
+
this.drawnRows = rows;
|
|
81
|
+
}
|
|
82
|
+
erase() {
|
|
83
|
+
if (this.drawnRows === 0)
|
|
84
|
+
return;
|
|
85
|
+
const up = this.drawnRows - 1;
|
|
86
|
+
this.out.write(`\r${up > 0 ? `\u001b[${up}A` : ''}\u001b[0J`);
|
|
87
|
+
this.drawnRows = 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sticky.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky.js","sourceRoot":"","sources":["../../src/progress/sticky.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,MAAM,OAAO,cAAc;IAMI;IALrB,OAAO,GAAG,EAAE,CAAC;IACb,GAAG,GAAG,EAAE,CAAC;IACT,SAAS,GAAG,CAAC,CAAC;IACd,OAAO,GAAG,KAAK,CAAC;IAExB,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD,6EAA6E;IAC7E,MAAM,CAAC,KAAa,EAAE,KAA6B;QACjD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,CAAC;YACb,OAAO;QACT,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,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AS,GAAG,CAAC,CAAC;IACrB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiesco",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Quiesco command line: init, test, doctor, tree",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Quiesco command line: init, test (with a progress bar), ui, list, doctor, tree",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "h2nology",
|
|
7
7
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"src"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@quiesco/core": "0.
|
|
47
|
+
"@quiesco/core": "0.3.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc -b",
|
package/src/cli.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/** Command dispatch for the `quiesco` binary (requirements.md §6.12). */
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
|
|
4
|
+
import { buildCommand } from './commands/build.js';
|
|
4
5
|
import { devicesCommand } from './commands/devices.js';
|
|
5
6
|
import { doctorCommand } from './commands/doctor.js';
|
|
6
7
|
import { initCommand } from './commands/init.js';
|
|
8
|
+
import { listCommand } from './commands/list.js';
|
|
7
9
|
import { testCommand } from './commands/test.js';
|
|
8
10
|
import { treeCommand } from './commands/tree.js';
|
|
11
|
+
import { uiCommand } from './commands/ui.js';
|
|
9
12
|
import type { CliContext } from './context.js';
|
|
10
13
|
import { defaultContext } from './context.js';
|
|
11
14
|
|
|
@@ -14,8 +17,14 @@ export const HELP = `Usage: quiesco <command> [options]
|
|
|
14
17
|
Commands:
|
|
15
18
|
init Set Quiesco up in this Expo project (dependencies, config plugin, Metro, entry, config, features)
|
|
16
19
|
--platforms ios,android,web --packages <dir> (install from tarballs) --skip-install
|
|
20
|
+
build Build the app for e2e tests (prebuild + xcodebuild / gradle) into apps.<platform>.binaryPath
|
|
21
|
+
ios|android --force (also when the native inputs did not change)
|
|
17
22
|
test Run the tests with cucumber-js (or --runner jest|vitest); other arguments go to the runner unchanged
|
|
18
|
-
--platform ios|android|web --workers N (N devices in parallel)
|
|
23
|
+
--platform ios|android|web --workers N (N devices in parallel) (quiesco test --help for more)
|
|
24
|
+
ui Open the test UI: run tests from the browser and watch them live (needs @quiesco/ui)
|
|
25
|
+
--platform ios|android|web --runner … --port N --no-open
|
|
26
|
+
list List the tests the runner would run, without running them
|
|
27
|
+
--runner cucumber|jest|vitest --json
|
|
19
28
|
doctor Check the tools and the project setup
|
|
20
29
|
--platform ios|android|web
|
|
21
30
|
tree Print the element tree of the running app (to find testIDs)
|
|
@@ -38,8 +47,14 @@ export async function main(argv: readonly string[], ctx: CliContext = defaultCon
|
|
|
38
47
|
switch (command) {
|
|
39
48
|
case 'init':
|
|
40
49
|
return await initCommand(args, ctx);
|
|
50
|
+
case 'build':
|
|
51
|
+
return await buildCommand(args, ctx);
|
|
41
52
|
case 'test':
|
|
42
53
|
return await testCommand(args, ctx);
|
|
54
|
+
case 'ui':
|
|
55
|
+
return await uiCommand(args, ctx);
|
|
56
|
+
case 'list':
|
|
57
|
+
return await listCommand(args, ctx);
|
|
43
58
|
case 'doctor':
|
|
44
59
|
return await doctorCommand(args, ctx);
|
|
45
60
|
case 'tree':
|