| applyTo | client/integration-tests/** |
|---|---|
| description | Instructions for working with client-side integration tests for the MCP server implementation. |
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.
- ALWAYS run
npm run build-and-testfrom 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 testfrom theclient/directory and ensure all integration tests pass before committing changes to integration tests. - ALWAYS fix lint errors by running
npm run lint:fixfrom 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, thenex_tool/ex_test/before/example_file.exshould have identical contents toex_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 Testsas described in the client/integration-tests/README.md file.
- 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.mdfile in each test directory, but not in any "before" or "after" subdirectories.
- 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,*.bqrsfiles must only be placed in the appropriateafter/directories underclient/integration-tests/primitives/tools/. - NEVER fabricate binary file contents - when integration tests require binary files (e.g.,
.bqrsfiles), they must be generated by actually running the appropriate tools, not by creating placeholder or fake content.