Merge pull request #621 from leblancfg/ci-test-cli

Run the CLI tests in CI
This commit is contained in:
Cliff Hall 2025-07-15 16:23:16 -04:00 • committed by GitHub
commit 1ea8e9a939
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 2 deletions

41
.github/workflows/cli_tests.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: CLI Tests
on:
push:
paths:
- "cli/**"
pull_request:
paths:
- "cli/**"
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- name: Install dependencies
run: |
cd ..
npm ci --ignore-scripts
- name: Build CLI
run: npm run build
- name: Explicitly pre-install test dependencies
run: npx -y @modelcontextprotocol/server-everything --help || true
- name: Run tests
run: npm test
env:
NPM_CONFIG_YES: true
CI: true

View file

@ -12,7 +12,7 @@ const colors = {
import fs from "fs";
import path from "path";
import { execSync, spawn } from "child_process";
import { spawn } from "child_process";
import os from "os";
import { fileURLToPath } from "url";

View file

@ -233,7 +233,7 @@ async function main(): Promise<void> {
const args = parseArgs();
if (args.cli) {
runCli(args);
await runCli(args);
} else {
await runWebClient(args);
}

View file

@ -287,6 +287,8 @@ async function main(): Promise<void> {
try {
const args = parseArgs();
await callMethod(args);
// Explicitly exit to ensure process terminates in CI
process.exit(0);
} catch (error) {
handleError(error);
}