Skip to content

Commit 83c6f2d

Browse files
authored
test: minor typing, annotation, config refactor (#55)
1 parent 0755c28 commit 83c6f2d

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

jest.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
const tsConfig = {
2+
useESM: true,
3+
tsconfig: '<rootDir>/tsconfig.json'
4+
};
5+
16
const baseConfig = {
27
extensionsToTreatAsEsm: ['.ts'],
38
preset: 'ts-jest',
@@ -7,8 +12,7 @@ const baseConfig = {
712
'^.+\\.(ts|tsx)$': [
813
'ts-jest',
914
{
10-
useESM: true,
11-
tsconfig: '<rootDir>/tsconfig.json'
15+
...tsConfig
1216
}
1317
]
1418
}

jest.setupTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ process.env.NODE_ENV = 'local';
1010
*/
1111
jest.mock('child_process', () => ({
1212
...jest.requireActual('child_process'),
13-
execSync: (...args: any) => `<execSync>${JSON.stringify(args)}</execSync>`
13+
execSync: (...args: unknown[]) => `<execSync>${JSON.stringify(args)}</execSync>`
1414
}));
1515

1616
/**

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"release": "changelog --non-cc --link-url https://github.com/patternfly/patternfly-mcp.git",
2626
"start": "node dist/cli.js --log-stderr",
2727
"start:dev": "tsx watch src/cli.ts --verbose --log-stderr",
28-
"test": "npm run test:lint && npm run test:types && jest --roots=src/",
28+
"test": "npm run test:lint && npm run test:types && jest --selectProjects unit --roots=src/",
2929
"test:dev": "npm test -- --watchAll",
30-
"test:integration": "npm run build && NODE_OPTIONS='--experimental-vm-modules' jest --roots=tests/",
30+
"test:integration": "npm run build && NODE_OPTIONS='--experimental-vm-modules' jest --selectProjects e2e --roots=tests/",
3131
"test:integration-dev": "npm run test:integration -- --watchAll",
3232
"test:lint": "eslint .",
3333
"test:lint-fix": "eslint . --fix",

tests/utils/httpTransportClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ export interface HttpTransportClient {
4545
/**
4646
* Start an HTTP server using the programmatic API and return a client for testing
4747
*
48+
* Logging notes. Logging does work with HTTP transport, with conditions
49+
* - You need to set `logging.protocol` to true to enable protocol logging
50+
* - Stdio transport logs technically work but they will bleed through to the testing framework
51+
* console and aren't currently captured by this client.
52+
* - Captured logs are dependent on server start up and shutdown. This means you need to provide
53+
* a "pause", like placing the server startup in a "beforeAll" to reliably capture most logs.
54+
* - Currently, the SDK does not support this object format `capabilities: { logging: {} }`. Typings
55+
* should throw an error if you try to use it.
56+
*
4857
* @param options - Server configuration options
4958
* @param settings - Additional settings for the server (e.g., allowProcessExit)
5059
*/

0 commit comments

Comments
 (0)