Skip to main content
Glama
project-root.test.ts1.24 kB
import { describe, test, expect } from 'vitest'; describe('project-root detection', () => { test('findProjectRoot function is exported', async () => { // Since we're running tests from within the project, we can't easily test // the actual path detection without complex mocking. Instead, we'll create // a separate test file that validates the logic. const module = await import('../index.js'); expect(module.findProjectRoot).toBeDefined(); expect(typeof module.findProjectRoot).toBe('function'); }); test('findProjectRoot throws when not in node_modules (development scenario)', async () => { // In development/test environment, we're not in node_modules // so the function should throw const module = await import('../index.js'); // This test will only pass when running tests directly (not from node_modules) // which is the normal test scenario try { module.findProjectRoot(); // If it doesn't throw, we must be in node_modules (unlikely in test env) expect(true).toBe(true); } catch (error) { expect(error).toBeInstanceOf(Error); expect((error as Error).message).toContain('must be run as an installed npm package'); } }); });

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/davstr1/peekabooMCP'

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