Skip to content

Commit 47cdeb4

Browse files
committed
revert(test): drop diagnostic instrumentation from typeorm specs
Reverts 53361ad, 3a8b42f, 528e1dc, 553740c, 190c9a7. These commits added console.log dumps of users/companies state at beforeAll and inside the c.basic-crud compound-key test for CI investigation. Root cause has been identified — see follow-up commit.
1 parent 53361ad commit 47cdeb4

2 files changed

Lines changed: 0 additions & 131 deletions

File tree

packages/typeorm/test/a.params-options.spec.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,6 @@ describe('#crud-typeorm', () => {
8989

9090
await app.init();
9191
server = app.getHttpServer();
92-
93-
try {
94-
const usersSvc: any = app.get(UsersService);
95-
const ds: any = usersSvc?.repo?.manager?.connection;
96-
if (ds?.query) {
97-
const isMy = ds.options?.type === 'mysql';
98-
const q = isMy ? '`' : '"';
99-
const userCount = await ds.query(`SELECT COUNT(*) AS c FROM users`);
100-
const allUsers = await ds.query(
101-
`SELECT id, ${q}companyId${q}, ${q}profileId${q} FROM users ORDER BY id`,
102-
);
103-
// eslint-disable-next-line no-console
104-
console.log(
105-
'[diag a.params beforeAll] dialect:',
106-
ds.options?.type,
107-
'count:',
108-
JSON.stringify(userCount),
109-
'allUsers:',
110-
JSON.stringify(allUsers),
111-
);
112-
}
113-
} catch (err) {
114-
// eslint-disable-next-line no-console
115-
console.log('[diag a.params beforeAll] failed:', (err as Error).message);
116-
}
11792
});
11893

11994
afterAll(async () => {

packages/typeorm/test/c.basic-crud.spec.ts

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -298,35 +298,6 @@ describe('#crud-typeorm', () => {
298298

299299
await app.init();
300300
server = app.getHttpServer();
301-
302-
// Diagnostic: snapshot users/companies state at #basic-crud beforeAll
303-
try {
304-
const usersSvc: any = app.get(UsersService);
305-
const ds: any = usersSvc?.repo?.manager?.connection;
306-
if (ds?.query) {
307-
const isMy = ds.options?.type === 'mysql';
308-
const q = isMy ? '`' : '"';
309-
const userCount = await ds.query(`SELECT COUNT(*) AS c FROM users`);
310-
const user5 = await ds.query(
311-
`SELECT id, ${q}companyId${q}, ${q}profileId${q}, ${q}deletedAt${q} FROM users WHERE id = 5 OR ${q}profileId${q} = 5`,
312-
);
313-
const companies = await ds.query(`SELECT id, ${q}deletedAt${q} FROM companies WHERE id IN (1, 2, 3, 4, 5) ORDER BY id`);
314-
// eslint-disable-next-line no-console
315-
console.log(
316-
'[diag beforeAll] dialect:',
317-
ds.options?.type,
318-
'userCount:',
319-
JSON.stringify(userCount),
320-
'user5:',
321-
JSON.stringify(user5),
322-
'companies1-5:',
323-
JSON.stringify(companies),
324-
);
325-
}
326-
} catch (err) {
327-
// eslint-disable-next-line no-console
328-
console.log('[diag beforeAll] failed:', (err as Error).message);
329-
}
330301
});
331302

332303
beforeEach(() => {
@@ -464,84 +435,7 @@ describe('#crud-typeorm', () => {
464435
});
465436
});
466437
it('should return an entity with compound key', async () => {
467-
// CI-side diagnostic: dump registered Express routes that mention `users4`,
468-
// then full response shape. Goal — prove whether the route is registered
469-
// at all in CI MySQL, and if so what NestJS actually returns.
470-
try {
471-
const router =
472-
(server as any)?._events?.request?._router ??
473-
(server as any)?._events?.request?.router ??
474-
(server as any)?.router;
475-
const stack = router?.stack ?? [];
476-
const routes: string[] = [];
477-
for (const layer of stack) {
478-
if (layer?.route?.path) {
479-
const methods = Object.keys(layer.route.methods || {}).join(',');
480-
routes.push(`${methods.toUpperCase()} ${layer.route.path}`);
481-
} else if (layer?.handle?.stack) {
482-
for (const sub of layer.handle.stack) {
483-
if (sub?.route?.path) {
484-
const methods = Object.keys(sub.route.methods || {}).join(',');
485-
routes.push(`${methods.toUpperCase()} ${sub.route.path}`);
486-
}
487-
}
488-
}
489-
}
490-
const users4Routes = routes.filter((r) => r.toLowerCase().includes('users4'));
491-
// eslint-disable-next-line no-console
492-
console.log(
493-
'[diag users4] count:',
494-
users4Routes.length,
495-
'sample:',
496-
JSON.stringify(users4Routes.slice(0, 10)),
497-
'total-routes:',
498-
routes.length,
499-
);
500-
} catch (err) {
501-
// eslint-disable-next-line no-console
502-
console.log('[diag users4] introspection failed:', (err as Error).message);
503-
}
504-
505-
// Second diag: dump user-5 row state directly via the app's DataSource,
506-
// then the targeted SELECT the route would emit. Catches mid-suite mutation.
507-
try {
508-
const usersSvc: any = app.get(UsersService);
509-
const ds: any = usersSvc?.repo?.manager?.connection;
510-
if (ds?.query) {
511-
const isMy = ds.options?.type === 'mysql';
512-
const q = isMy ? '`' : '"';
513-
const cols = `id, ${q}companyId${q}, ${q}profileId${q}, ${q}deletedAt${q}`;
514-
const all5 = await ds.query(`SELECT ${cols} FROM users WHERE id = 5 OR ${q}profileId${q} = 5`);
515-
// eslint-disable-next-line no-console
516-
console.log('[diag user5 rows]', JSON.stringify(all5));
517-
const targeted = await ds.query(
518-
`SELECT ${cols} FROM users WHERE ${q}companyId${q} = 1 AND ${q}profileId${q} = 5 AND ${q}deletedAt${q} IS NULL`,
519-
);
520-
// eslint-disable-next-line no-console
521-
console.log('[diag targeted]', JSON.stringify(targeted));
522-
} else {
523-
// eslint-disable-next-line no-console
524-
console.log('[diag] no DataSource on app');
525-
}
526-
} catch (err) {
527-
// eslint-disable-next-line no-console
528-
console.log('[diag db query failed]', (err as Error).message);
529-
}
530-
531438
const res = await request(server).get('/users4/1/5');
532-
if (res.status !== 200) {
533-
// eslint-disable-next-line no-console
534-
console.log(
535-
'[diag /users4/1/5] status:',
536-
res.status,
537-
'body:',
538-
JSON.stringify(res.body),
539-
'text:',
540-
res.text,
541-
'headers:',
542-
JSON.stringify(res.headers),
543-
);
544-
}
545439
expect(res.status).toBe(200);
546440
expect(res.body.id).toBe(5);
547441
});

0 commit comments

Comments
 (0)