From 8c2849086cf7c9da0b4a489cf34d33a83b936faf Mon Sep 17 00:00:00 2001 From: hamdymohamedak Date: Sat, 24 Oct 2026 21:31:32 +0300 Subject: [PATCH] test: lock the init template's Bun and Node built-in types Keep @types/bun and tsconfig "types": ["bun"] in the scaffold so IDEs keep resolving node:fs and node:path (issue #20). Co-authored-by: Cursor --- tests/unit/cli/init.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/cli/init.test.ts b/tests/unit/cli/init.test.ts index 5d35464..b0755da 100644 --- a/tests/unit/cli/init.test.ts +++ b/tests/unit/cli/init.test.ts @@ -52,6 +52,21 @@ describe('initTemplateFiles', () => { expect(pkg.dependencies.bunmaska).toMatch(/^\^/); }); + // Issue #20: IDEs must resolve node:fs / node:path / Bun built-ins out of the box. + test('package.json declares @types/bun so language servers see Node and Bun built-ins', () => { + const pkg = JSON.parse(byPath.get('package.json') ?? '{}') as { + devDependencies?: Record; + }; + expect(pkg.devDependencies?.['@types/bun']).toBeTruthy(); + }); + + test('tsconfig includes bun types for the editor language server', () => { + const tsconfig = JSON.parse(byPath.get('tsconfig.json') ?? '{}') as { + compilerOptions?: { types?: string[] }; + }; + expect(tsconfig.compilerOptions?.types).toContain('bun'); + }); + test('config substitutes the name and id', () => { const config = byPath.get('bunmaska.config.ts') ?? ''; expect(config).toContain('name: "My App"');