Skip to main content
Glama
push-based

Angular Toolkit MCP

by push-based
fs-memfs.setup-file.ts1.68 kB
import { MockInstance, afterEach, beforeEach, vi, beforeAll, afterAll, } from 'vitest'; // Define the constant locally since cross-project imports cause build issues const MEMFS_VOLUME = '/memfs'; /** * Mocks the fs and fs/promises modules with memfs. */ type Memfs = typeof import('memfs'); vi.mock('fs', async () => { const memfs: Memfs = await vi.importActual('memfs'); return memfs.fs; }); vi.mock('fs/promises', async () => { const memfs: Memfs = await vi.importActual('memfs'); return memfs.fs.promises; }); /** * Mocks the current working directory to MEMFS_VOLUME. * This is useful when you use relative paths in your code * @type {MockInstance<[], string>} * * @example * - `readFile('./file.txt')` reads MEMFS_VOLUME/file.txt * - `readFile(join(process.cwd(), 'file.txt'))` reads MEMFS_VOLUME/file.txt * - `readFile('file.txt')` reads file.txt */ let cwdSpy: MockInstance; // This covers arrange blocks at the top of a "describe" block beforeAll(() => { cwdSpy = vi.spyOn(process, 'cwd').mockReturnValue(MEMFS_VOLUME); }); // Clear mock usage data in arrange blocks as well as usage of the API in each "it" block. // docs: https://vitest.dev/api/mock.html#mockclear beforeEach(() => { cwdSpy.mockClear(); }); // Restore mock implementation and usage data "it" block // Mock implementations remain if given. => vi.fn(impl).mockRestore() === vi.fn(impl) // docs: https://vitest.dev/api/mock.html#mockrestore afterEach(() => { cwdSpy.mockRestore(); }); // Restore the original implementation after all "describe" block in a file // docs: https://vitest.dev/api/mock.html#mockreset afterAll(() => { cwdSpy.mockReset(); });

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/push-based/angular-toolkit-mcp'

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