Skip to content

Commit 66f5a07

Browse files
authored
test(cli): debug-result-summary times each case on its own command (#9876)
test(cli): debug-result-summary times each case on its own command The file's beforeAll built every command, and on a busy machine loading them all ran past its 30 s hook limit. Its first case ran an open search, which first gathers every component, hook, doc, template and theme. The beforeAll now loads only the search command, which the first two cases run, and each case builds only the command it runs, as the test helper does by default. The first case searches with `--type theme`, which reads seven themes. The 'mixed' kind stays covered in debug-fields.test.mjs.
1 parent 6f3befa commit 66f5a07

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

‎packages/cli/clients/cli/commands/debug-result-summary.test.mjs‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ async function runWithDebug(args) {
4545
return {run, event: events[0]};
4646
}
4747

48-
// Every command module loads here, once. A command loads the project module
49-
// only when it runs. Without this, the first case's window times that first
50-
// load as well as the run.
48+
// Each case builds only the command it runs, as a run of the bin does. The
49+
// search command's modules load here, once, because the first two cases run
50+
// it. Without this, the first case's window times that load as well.
5151
beforeAll(async () => {
52-
await createProgram();
52+
await createProgram({argv: ['search']});
5353
});
5454

5555
afterEach(() => resetRecorder());
@@ -58,17 +58,23 @@ describe('DebugEvent result summary', () => {
5858
it(
5959
'distinguishes a successful search with no results',
6060
async () => {
61+
// A typed search reads only its own domain. An open search first
62+
// gathers every domain, which took most of this case's time on a busy
63+
// machine. debug-fields.test.mjs covers the 'mixed' kind.
6164
const {event} = await runWithDebug([
6265
'search',
66+
'--type',
67+
'theme',
6368
'zzqqxx_definitely_no_match',
6469
]);
6570
expect(event.outcome).toBe('ok');
6671
expect(event.output).toMatchObject({
6772
resultCount: 0,
6873
emptyResult: true,
69-
// An open search really did span every domain, and saying so beats a
70-
// null that cannot be told apart from a command that never reported.
71-
resultKind: 'mixed',
74+
// With no results, the `--type` filter still says what was searched
75+
// for. That beats a null that cannot be told apart from a command
76+
// that never reported.
77+
resultKind: 'theme',
7278
directMatch: null,
7379
});
7480
},

0 commit comments

Comments
 (0)