Skip to main content
Glama

MongoDB MCP Server

Official
by mongodb-js
no-config-imports.test.js2.56 kB
import path from "path"; import { RuleTester } from "eslint"; import { describe, it } from "vitest"; import tsParser from "@typescript-eslint/parser"; import rule from "./no-config-imports.js"; const ROOT = process.cwd(); const resolve = (p) => path.resolve(ROOT, p); const ruleTester = new RuleTester({ languageOptions: { parser: tsParser, parserOptions: { ecmaVersion: 2022, sourceType: "module" }, }, }); describe("no-config-imports", () => { it("should not report any violations", () => { ruleTester.run("no-config-imports", rule, { valid: [ { filename: resolve("src/some/module.ts"), code: 'import type { UserConfig } from "../common/config.js";\n', }, { filename: resolve("src/some/module.ts"), code: 'import { something } from "../common/logger.js";\n', }, { filename: resolve("src/some/module.ts"), code: 'import type * as Cfg from "../common/config.js";\n', }, { filename: resolve("src/index.ts"), code: 'import { driverOptions } from "../common/config.js";\n', }, ], invalid: [], }); }); it("should report rule violations", () => { ruleTester.run("no-config-imports", rule, { valid: [], invalid: [ { filename: resolve("src/another/module.ts"), code: 'import { driverOptions } from "../common/config.js";\n', errors: [{ messageId: "noConfigImports" }], }, { filename: resolve("src/another/module.ts"), code: 'import configDefault from "../common/config.js";\n', errors: [{ messageId: "noConfigImports" }], }, { filename: resolve("src/another/module.ts"), code: 'import * as cfg from "../common/config.js";\n', errors: [{ messageId: "noConfigImports" }], }, { filename: resolve("src/another/module.ts"), code: 'import { type UserConfig, driverOptions } from "../common/config.js";\n', errors: [{ messageId: "noConfigImports" }], }, ], }); }); });

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/mongodb-js/mongodb-mcp-server'

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