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.
14 lines (12 loc) • 699 B
JavaScript
require('qtests/setup'); // setup qtests before requiring modules
const { test, expect, describe } = require('@jest/globals'); // jest globals
const fs = require('fs');
const utils = require('../utils'); // library utilities
describe('hasUncommentedCode invalid path', () => { // group related tests
test('throws error for missing file', async () => { // ensure error handling works
const invalidPath = './definitely-not-here.js'; // path guaranteed not to exist
jest.spyOn(fs, 'createReadStream').mockImplementation(() => { throw new Error('ENOENT'); });
await expect(utils.hasUncommentedCode(invalidPath)).rejects.toThrow('ENOENT');
fs.createReadStream.mockRestore();
});
});