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