Skip to main content
Glama
rules_test.ts1.08 kB
import { assertEquals } from "jsr:@std/assert"; import plugin from "../lint/mod.ts"; Deno.test("no-deno-env-get rule - detects Deno.env.get() calls", () => { const code = ` const apiKey = Deno.env.get("API_KEY"); const token = Deno.env.get("TOKEN"); `; const diagnostics = Deno.lint.runPlugin( plugin, "test.ts", code, ); // Should find 2 violations assertEquals(diagnostics.length, 2); assertEquals(diagnostics[0].id, "si-rules/no-deno-env-get"); assertEquals(diagnostics[1].id, "si-rules/no-deno-env-get"); assertEquals( diagnostics[0].message, "Direct usage of Deno.env.get() is not allowed. Use proper CLI parsing and configuration injection methods instead.", ); }); Deno.test("no-deno-env-get rule - allows other Deno API calls", () => { const code = ` const cwd = Deno.cwd(); const args = Deno.args; const value = Deno.env.set("KEY", "value"); `; const diagnostics = Deno.lint.runPlugin( plugin, "test.ts", code, ); // Should find no violations assertEquals(diagnostics.length, 0); });

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/systeminit/si'

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