Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 3.75 KB

File metadata and controls

39 lines (29 loc) · 3.75 KB
applyTo client/integration-tests/**
description Instructions for working with client-side integration tests for the MCP server implementation.

Copilot Instructions for client/integration-tests/** test files

PURPOSE

This file contains instructions for working with test files in the client/integration-tests/ directory of the codeql-development-mcp-client repository.

The purpose of the entire client/** implementation is to provide integration tests for the MCP server primitives, as implemented in server/src/**/*.ts files. The client/integration-tests/** directory contains a directory structur that reflects the endpoints of the MCP server primitives under test, where a given parent test directory should contain child/leaf test subdirectories for expected contents of some file(s) "before" versus "after" calling the MCP server primitive (e.g. MCP server tool) under test.

REQUIREMENTS

  • ALWAYS run npm run build-and-test from the repo root directory and ensure it passes completely before committing any changes. This is MANDATORY and must be verified before every commit.
  • ALWAYS run npm test from the client/ directory and ensure all integration tests pass before committing changes to integration tests.
  • ALWAYS fix lint errors by running npm run lint:fix from the repo root directory before committing changes.
  • ALWAYS define "before" and "after" files for monitoring-state.json, plus any other files used as integration test inputs (before) and outputs (after). If a file is used as an input but is not modified by the MCP server tool under test, then ex_tool/ex_test/before/example_file.ex should have identical contents to ex_tool/ex_test/after/example_file.ex.
  • ALWAYS follow the structure for integration tests as described in the client/integration-tests/README.md file.
  • ALWAYS obey the Requirements for Integration Tests as described in the client/integration-tests/README.md file.

PREFERENCES

  • PREFER implementing simple, focused integration tests that target a specific MCP server primitive.
  • PREFER a single integration test per MCP server primitive before building any more complex integration tests that combine multiple MCP server primitives.
  • PREFER to put a README.md file in each test directory, but not in any "before" or "after" subdirectories.

CONSTRAINTS

  • NEVER leave any trailing whitespace on any line.
  • NEVER write overly complex tests that test multiple concerns in a single test case.
  • NEVER create an integration test that does not have a corresponding MCP server primitive implementation.
  • NEVER create an integration test whose results are not deterministic or repeatable.
  • NEVER create an integration test that does not have a clear "before" and "after" state.
  • NEVER create or use "mock" or "fake" file paths in integration tests; create "before" and "after" files for files that are modified by the tool. For files that are used as inputs but not modified (like static query files and test databases), reference them from the server/ql/<language>/examples/ directories instead.
  • NEVER pollute the "before" and "after" directories with files that are not used (before) or produced (after) by the MCP server primitive under test.
  • NEVER commit integration test output files to the repository root directory - files like evaluator-log.json, query-results.bqrs, *.bqrs files must only be placed in the appropriate after/ directories under client/integration-tests/primitives/tools/.
  • NEVER fabricate binary file contents - when integration tests require binary files (e.g., .bqrs files), they must be generated by actually running the appropriate tools, not by creating placeholder or fake content.