Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ jobs:

- name: Test
run: npx turbo test
env:
DO_NOT_TRACK: '1'
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:

- name: Test
run: npx turbo test
env:
DO_NOT_TRACK: '1'

deploy:
name: Deploy to Fly.io
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ jobs:

- name: Run tests
run: npx turbo test
env:
DO_NOT_TRACK: '1'

- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down
40 changes: 40 additions & 0 deletions packages/mcp/src/__tests__/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ import fs from 'node:fs';
import path from 'node:path';

const mockHomedir = vi.hoisted(() => '/mock/home');
const posthogRequestMock = vi.hoisted(() =>
vi.fn(
(
_options: unknown,
callback?: (res: { resume: () => void; on: (event: string, listener: () => void) => void }) => void,
) => {
const endListeners: Array<() => void> = [];
callback?.({
resume: () => undefined,
on: (event: string, listener: () => void) => {
if (event === 'end') {
endListeners.push(listener);
}
},
});

return {
on: vi.fn(),
setTimeout: vi.fn(),
destroy: vi.fn(),
write: vi.fn(),
end: vi.fn(() => {
for (const listener of endListeners) {
listener();
}
}),
};
},
),
);

vi.mock('node:os', () => ({
default: {
Expand All @@ -11,6 +41,16 @@ vi.mock('node:os', () => ({
}));

vi.mock('node:fs');
vi.mock('node:http', () => ({
default: {
request: posthogRequestMock,
},
}));
vi.mock('node:https', () => ({
default: {
request: posthogRequestMock,
},
}));

import { createMcpTelemetry } from '../telemetry.js';

Expand Down
Loading