Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

ci: run the UI and MCP TypeScript tests on pull requests (#25)

Stefan Petrovicid707de8fc6b9
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..41ddad9
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,38 @@
+name: TypeScript tests
+
+on:
+ pull_request:
+ push:
+ branches: [master]
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+ cache-dependency-path: |
+ package-lock.json
+ mcp/package-lock.json
+ - name: Install UI dependencies
+ run: npm ci
+ - name: Typecheck UI
+ run: npx tsc --noEmit
+ - name: Test UI
+ run: npm test
+ - name: Install MCP dependencies
+ working-directory: mcp
+ run: npm ci
+ - name: Typecheck MCP
+ working-directory: mcp
+ run: npm run typecheck
+ # The protocol test needs a built kokon-service and MCP bundle; the others need no binaries.
+ - name: Test MCP paths, tools and version
+ working-directory: mcp
+ run: npm test -- test/paths.test.ts test/tools.test.ts test/version.test.ts
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 49e179d..d666648 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,6 +50,12 @@ cd mcp && npm test # MCP server, including a stdio protocol test
The MCP server has its own `package.json`: run `npm install` in `mcp/` once before its tests.
+GitHub Actions runs the UI and MCP TypeScript checks and unit tests on pull requests and pushes
+to `master`, using Node 22. To run the MCP unit tests without the protocol test, use
+`cd mcp && npm test -- test/paths.test.ts test/tools.test.ts test/version.test.ts`. The protocol test is excluded
+from CI for now: it requires a built `kokon-service` (`cargo build -p qls-service`) and the
+MCP bundle (`cd mcp && npm run build`).
+
## Where things live
- `crates/qls-core`: all the logic (geometry, imaging, planner, inference adapter, job queue,
diff --git a/vite.config.ts b/vite.config.ts
index ed445c3..9ac15fa 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -8,5 +8,5 @@ export default defineConfig({
// warmup: compile the app as soon as the dev server starts, not when the window asks for it.
server: { port: 1420, strictPort: true, host: "127.0.0.1", warmup: { clientFiles: ["./src/main.tsx"] } },
build: { target: "es2022", sourcemap: false, chunkSizeWarningLimit: 1500 },
- test: { environment: "jsdom" },
+ test: { include: ["src/**/*.test.{ts,tsx}"], environment: "jsdom" },
});