fix: add context-generator.cjs to SHEBANG_SCRIPTS and assert file existence

- Add missing context-generator.cjs to the SHEBANG_SCRIPTS list so CRLF
  regressions in that script are caught by the test suite
- Replace silent early-returns with expect(existsSync(filePath)).toBe(true)
  so the suite fails loudly when expected build artifacts are absent

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ousama Ben Younes
2026-04-10 10:51:34 +00:00
parent f61eb2d162
commit 5ac54239d8

View File

@@ -20,6 +20,7 @@ const SCRIPTS_DIR = join(import.meta.dir, '..', 'plugin', 'scripts');
const SHEBANG_SCRIPTS = [
'mcp-server.cjs',
'worker-service.cjs',
'context-generator.cjs',
'bun-runner.js',
'smart-install.js',
'worker-cli.js',
@@ -30,10 +31,7 @@ describe('plugin/scripts line endings (#1342)', () => {
const filePath = join(SCRIPTS_DIR, filename);
it(`${filename} shebang line must not contain CRLF`, () => {
if (!existsSync(filePath)) {
// Skip if not yet built (CI may not have run the build step)
return;
}
expect(existsSync(filePath)).toBe(true);
const content = readFileSync(filePath, 'binary');
const firstLine = content.split('\n')[0];
// CRLF would leave a trailing \r on the shebang line
@@ -41,9 +39,7 @@ describe('plugin/scripts line endings (#1342)', () => {
});
it(`${filename} must not contain any CRLF sequences`, () => {
if (!existsSync(filePath)) {
return;
}
expect(existsSync(filePath)).toBe(true);
const content = readFileSync(filePath, 'binary');
expect(content.includes('\r\n')).toBe(false);
});