Skip to content

Commit cf2af47

Browse files
committed
test: warm lazily-loaded deps at module top in the edited drafts tests
check:test-source-alias asks every edited test whose source reaches a dynamic import to pay that first load during collection. Claude-Session: https://claude.ai/code/session_01FEkQ5mNZhe975x6zR3ULqS Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2ef9def commit cf2af47

24 files changed

Lines changed: 72 additions & 0 deletions

‎packages/rest/src/meta-drafts-unknown-filter.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
*/
2525

2626
import { describe, it, expect, vi } from 'vitest';
27+
// Pays `@objectstack/objectql`'s first load at collection, never inside a clocked case
28+
// (the source under test imports it lazily; `check:test-source-alias`).
29+
import '@objectstack/objectql';
2730
import { RestServer } from './rest-server.js';
2831

2932
function mockRes() {

‎packages/rest/src/meta-query-arity-doors.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import {
3030
} from './meta-item-read-gate.js';
3131
import { unknownQueryParamMessage } from './query-allowlist.js';
3232
import { repeatedQueryParamMessage } from './query-multiplicity.js';
33+
// Pays `@objectstack/objectql`'s first load at collection, never inside a clocked case
34+
// (the source under test imports it lazily; `check:test-source-alias`).
35+
import '@objectstack/objectql';
3336
import { RestServer } from './rest-server.js';
3437

3538
const DOORS = Object.keys(META_QUERY_ARITY_DOORS) as MetaQueryArityDoor[];

‎packages/rest/src/rest-server-query-multiplicity.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
import { describe, it, expect, vi } from 'vitest';
5959
// `.js` on purpose — NodeNext resolution requires the extension, and this
6060
// package's TEST_DEBT ceiling has no margin for another TS2835 (#7248).
61+
// Pays `@objectstack/objectql`'s first load at collection, never inside a clocked case
62+
// (the source under test imports it lazily; `check:test-source-alias`).
63+
import '@objectstack/objectql';
6164
import { RestServer } from './rest-server.js';
6265
import { refuseRepeatedQueryParams, readSingleQueryValue } from './query-multiplicity.js';
6366

‎packages/runtime/src/domains/dispatcher-query-arity.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ import {
4545
repeatedQueryParamMessage,
4646
unknownQueryParamRefusalMessage,
4747
} from '@objectstack/rest';
48+
// Pays `@objectstack/metadata`'s first load at collection, never inside a clocked case
49+
// (the source under test imports it lazily; `check:test-source-alias`).
50+
import '@objectstack/metadata';
4851
import { HttpDispatcher } from '../http-dispatcher.js';
4952

5053
const SCHEMA = {

‎packages/runtime/src/domains/meta-drafts-unknown-type.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212

1313
import { describe, it, expect, vi } from 'vitest';
14+
// Pays `@objectstack/metadata`'s first load at collection, never inside a clocked case
15+
// (the source under test imports it lazily; `check:test-source-alias`).
16+
import '@objectstack/metadata';
1417
import { HttpDispatcher } from '../http-dispatcher.js';
1518

1619
const AUTHOR = { userId: 'u_author', isSystem: false, systemPermissions: ['manage_metadata', 'studio.access'] };

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.aiStudioDisabled.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead:
138138
// like every other source this page reads.
139139
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
140140

141+
// The console's preview and authoring code loads `@objectstack/lint` lazily;
142+
// warmed here so its first load is paid at import, not inside a test's clock.
143+
import '@objectstack/lint';
141144
import { HomePage } from '../HomePage';
142145

143146
/**

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.approvalsTarget.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ vi.mock('../../../runtime-config', () => ({
135135
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
136136
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
137137

138+
// The console's preview and authoring code loads `@objectstack/lint` lazily;
139+
// warmed here so its first load is paid at import, not inside a test's clock.
140+
import '@objectstack/lint';
138141
import { HomePage } from '../HomePage';
139142

140143
/* ── The `_drafts` double (objectui#7307) ─────────────────────────────────────

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead:
150150
// like every other source this page reads.
151151
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
152152

153+
// The console's preview and authoring code loads `@objectstack/lint` lazily;
154+
// warmed here so its first load is paid at import, not inside a test's clock.
155+
import '@objectstack/lint';
153156
import { HomePage } from '../HomePage';
154157

155158
/* ── The `_drafts` double (objectui#7307) ─────────────────────────────────────

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.inboxLinksTarget.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead:
144144
// like every other source this page reads.
145145
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
146146

147+
// The console's preview and authoring code loads `@objectstack/lint` lazily;
148+
// warmed here so its first load is paid at import, not inside a test's clock.
149+
import '@objectstack/lint';
147150
import { HomePage } from '../HomePage';
148151

149152
/* ── The `_drafts` double (objectui#7307) ─────────────────────────────────────

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.marketplaceDisabled.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead:
117117
// like every other source this page reads.
118118
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
119119

120+
// The console's preview and authoring code loads `@objectstack/lint` lazily;
121+
// warmed here so its first load is paid at import, not inside a test's clock.
122+
import '@objectstack/lint';
120123
import { HomePage } from '../HomePage';
121124

122125
/** A `GET /api/v1/runtime/config` answer, as the server sends it. */

0 commit comments

Comments
 (0)