Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(cli): debug-result-summary times each case on its own command (#9876)

Christopher Chedeau66f5a07df4bf
diff --git a/packages/cli/clients/cli/commands/debug-result-summary.test.mjs b/packages/cli/clients/cli/commands/debug-result-summary.test.mjs
index df5d6a3b90..3fbe401ac4 100644
--- a/packages/cli/clients/cli/commands/debug-result-summary.test.mjs
+++ b/packages/cli/clients/cli/commands/debug-result-summary.test.mjs
@@ -45,11 +45,11 @@ async function runWithDebug(args) {
return {run, event: events[0]};
}
-// Every command module loads here, once. A command loads the project module
-// only when it runs. Without this, the first case's window times that first
-// load as well as the run.
+// Each case builds only the command it runs, as a run of the bin does. The
+// search command's modules load here, once, because the first two cases run
+// it. Without this, the first case's window times that load as well.
beforeAll(async () => {
- await createProgram();
+ await createProgram({argv: ['search']});
});
afterEach(() => resetRecorder());
@@ -58,17 +58,23 @@ describe('DebugEvent result summary', () => {
it(
'distinguishes a successful search with no results',
async () => {
+ // A typed search reads only its own domain. An open search first
+ // gathers every domain, which took most of this case's time on a busy
+ // machine. debug-fields.test.mjs covers the 'mixed' kind.
const {event} = await runWithDebug([
'search',
+ '--type',
+ 'theme',
'zzqqxx_definitely_no_match',
]);
expect(event.outcome).toBe('ok');
expect(event.output).toMatchObject({
resultCount: 0,
emptyResult: true,
- // An open search really did span every domain, and saying so beats a
- // null that cannot be told apart from a command that never reported.
- resultKind: 'mixed',
+ // With no results, the `--type` filter still says what was searched
+ // for. That beats a null that cannot be told apart from a command
+ // that never reported.
+ resultKind: 'theme',
directMatch: null,
});
},