test: root module spec supplies its own JWT secret
Backend Image / build-and-push (push) Successful in 4m35s
Frontend Image / build-and-push (push) Failing after 7m55s

CI builds have no .env file; the handler discovery test compiled the API
module without JWT_ACCESS_SECRET when no earlier suite in the same jest
worker had set it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-14 18:38:22 +02:00
1 parent c2f71bcb03
commit ffaefab834
1 file changed
+13
@@ -100,11 +100,24 @@ describe('rootModuleFor', () => {
// Only the worker dispatches events. A handler in a module the worker // Only the worker dispatches events. A handler in a module the worker
// does not import would be registered by the API and never run. // does not import would be registered by the API and never run.
it('the worker discovers exactly the domain event handlers of the API', async () => { it('the worker discovers exactly the domain event handlers of the API', async () => {
// Compiling the API constructs JwtStrategy, which needs a secret. CI
// builds have no .env file, so the test supplies one itself instead of
// relying on another suite of the same worker having set it.
const previousSecret = process.env.JWT_ACCESS_SECRET;
process.env.JWT_ACCESS_SECRET ||= 'root-module-spec-'.padEnd(40, 'x');
try {
const api = await discoveredHandlerIds(AppModule); const api = await discoveredHandlerIds(AppModule);
const worker = await discoveredHandlerIds(WorkerModule); const worker = await discoveredHandlerIds(WorkerModule);
expect(api).toContain('webhooks.forward'); expect(api).toContain('webhooks.forward');
expect(worker).toEqual(api); expect(worker).toEqual(api);
} finally {
if (previousSecret === undefined) {
delete process.env.JWT_ACCESS_SECRET;
} else {
process.env.JWT_ACCESS_SECRET = previousSecret;
}
}
}, 30_000); }, 30_000);
}); });