fix(core): normalize CRLF line endings in step scripts (#1)
Bash treats a trailing carriage return as part of the command, so notebooks saved with CRLF endings produced broken scripts.
This commit is contained in:
@@ -83,7 +83,8 @@ describe("parser", () => {
|
||||
it("uses title fallback, numeric step ids, CRLF ranges and exact script whitespace", () => {
|
||||
expect(parseNotebook("").title).toBe("Untitled");
|
||||
const n = parseNotebook("---\r\ntitle: Front\r\n---\r\n# Heading\r\n```sh {run}\r\n echo x \r\n\r\n```\r\n");
|
||||
expect(n.title).toBe("Front"); expect(steps(n.blocks)[0]).toMatchObject({ script: " echo x \r\n\r\n", attrs: { id: "step-1" }, range: { startLine: 5, endLine: 8 } });
|
||||
// Scripts are executed by bash: CRLF line endings must not leak a trailing \r into commands.
|
||||
expect(n.title).toBe("Front"); expect(steps(n.blocks)[0]).toMatchObject({ script: " echo x \n\n", attrs: { id: "step-1" }, range: { startLine: 5, endLine: 8 } });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user