Skip to main content
Glama
publish-checks.spec.ts3.25 kB
import { describe, it, expect } from 'vitest'; import { spawnSync } from 'child_process'; import fs from 'fs'; describe('Package Publication Checks', () => { it('version in package.json matches actual exported version', async () => { // Import the dynamically determined version from config const { config } = await import('../src/config.js'); const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); expect(config.version).toBe(packageJson.version); }); it('CLI binary can execute and returns correct version', () => { const result = spawnSync('node', ['./bin/mcp-think-tank.js', '--version'], { encoding: 'utf8' }); expect(result.status).toBe(0); const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); expect(result.stderr).toContain(`mcp-think-tank v${packageJson.version}`); }); it('package files configuration is correct', () => { // Instead of checking npm pack output, check the package.json files array const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); expect(packageJson.files).toContain('dist'); expect(packageJson.files).toContain('bin'); // Check that the actual files exist expect(fs.existsSync('./bin/mcp-think-tank.js')).toBe(true); expect(fs.existsSync('./dist/src/server.js')).toBe(true); }); it('CHANGELOG.md contains entry for current version', () => { const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); const changelog = fs.readFileSync('./CHANGELOG.md', 'utf8'); expect(changelog).toContain(`## ${packageJson.version}`); }); it('server exports needed FastMCP resources and templates', () => { // More reliable check for server implementation rather than runtime const resourcesContent = fs.readFileSync('./src/core/resources.ts', 'utf8'); // Check for resource registration expect(resourcesContent).toContain('server.addResource'); expect(resourcesContent).toContain('uri: \'status://health\''); // Check for resource template registration expect(resourcesContent).toContain('server.addResourceTemplate'); expect(resourcesContent).toContain('uriTemplate: \'task://{id}\''); }); it('server can start with --show-memory-path flag', () => { const result = spawnSync('node', ['./bin/mcp-think-tank.js', '--show-memory-path'], { encoding: 'utf8' }); expect(result.status).toBe(0); expect(result.stderr).not.toContain('Error'); expect(result.stderr.length || result.stdout.length).toBeGreaterThan(0); }); it('smoke test can run via npx on the current package', () => { // Skip this test in CI environments as it may be complex to set up if (process.env.CI) { return; } const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); const packageVersion = packageJson.version; // Use a simpler test that just checks if we can run the version command const testCommand = `node ./bin/mcp-think-tank.js --version`; const result = spawnSync('bash', ['-c', testCommand], { encoding: 'utf8' }); expect(result.status).toBe(0); expect(result.stderr + result.stdout).toContain(packageVersion); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flight505/mcp-think-tank'

If you have feedback or need assistance with the MCP directory API, please join our Discord server