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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F8Mgg1vd2eKSs8StZiuyMV
This commit is contained in:
Chris Sherwood 2026-08-30 10:52:26 -07:00 committed by Jake Turner
parent 8a920188de
commit 0a93e7de80

View File

@ -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'