UNPKG

unqommented

Version:

A Node.js utility that quickly identifies files with uncommented code in your codebase. Designed for developers who want to efficiently tell LLMs exactly which files need comments added.

35 lines (29 loc) 1.06 kB
require('qtests/setup'); const { test, expect, describe, beforeAll, afterAll } = require('@jest/globals'); const fs = require('fs'); const path = require('path'); const os = require('os'); const utils = require('../utils'); let tmpDir; let slashFile; let blockFile; beforeAll(() => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'unqommented-')); slashFile = path.join(tmpDir, 'slash.js'); fs.writeFileSync(slashFile, 'const msg = "not a // comment";'); blockFile = path.join(tmpDir, 'block.js'); fs.writeFileSync(blockFile, 'const msg = "not a /* comment */ either";'); }); afterAll(() => { fs.rmSync(tmpDir, { recursive: true, force: true }); }); describe('hasUncommentedCode strings with comment markers', () => { test('handles double slash inside string', async () => { const result = await utils.hasUncommentedCode(slashFile); expect(result).toBe(true); }); test('handles block markers inside string', async () => { const result = await utils.hasUncommentedCode(blockFile); expect(result).toBe(true); }); });