From 0a93e7de80930bc308b9d9668ad23557f35a30b4 Mon Sep 17 00:00:00 2001 From: Chris Sherwood Date: Sun, 30 Aug 2026 10:52:26 -0700 Subject: [PATCH] test(ai): run the controller vision spec under Japa It constructs OllamaController, which imports the Adonis logger service at module scope, so it cannot run under the plain node:test runner. It failed identically on the original branch -- the coverage has never executed. Moving it to the Japa runner puts it in the same bucket as the other app-importing specs, where a booted app is available. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01F8Mgg1vd2eKSs8StZiuyMV --- admin/tests/unit/ollama_controller_chat.spec.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/admin/tests/unit/ollama_controller_chat.spec.ts b/admin/tests/unit/ollama_controller_chat.spec.ts index 364e63fc..13564682 100644 --- a/admin/tests/unit/ollama_controller_chat.spec.ts +++ b/admin/tests/unit/ollama_controller_chat.spec.ts @@ -1,9 +1,17 @@ +/** + * Controller-level vision behaviour (#1176). + * + * A Japa spec, not a plain `node:test` file: it constructs OllamaController, + * which imports '@adonisjs/core/services/logger' at module scope and therefore + * needs a booted app. Run with `node ace test unit`, not `npm run test:unit` -- + * the latter is the plain-runner path used by the pure-function specs. + */ import assert from 'node:assert/strict' import { EventEmitter } from 'node:events' import { mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' -import test from 'node:test' +import { test } from '@japa/runner' import sharp from 'sharp' import OllamaController from '../../app/controllers/ollama_controller.js'