aboutsummaryrefslogtreecommitdiff
path: root/test/regression/issue/4893.test.ts
blob: 43850693bef08589bb146ebdf94d03869b80e61b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { bunEnv, bunExe } from "harness";
import { mkdirSync, rmSync, writeFileSync, readFileSync, mkdtempSync } from "fs";
import { tmpdir } from "os";
import { join } from "path";

it("correctly handles CRLF multiline string in CRLF terminated files", async () => {
  const testDir = mkdtempSync(join(tmpdir(), "issue4893-"));

  // Clean up from prior runs if necessary
  rmSync(testDir, { recursive: true, force: true });

  // Create a directory with our test CRLF terminated file
  mkdirSync(testDir, { recursive: true });
  writeFileSync(join(testDir, "crlf.js"), '"a\\\r\nb"');

  const { stdout, exitCode } = Bun.spawnSync({
    cmd: [bunExe(), "run", join(testDir, "crlf.js")],
    env: bunEnv,
    stderr: "inherit",
  });

  expect(exitCode).toBe(0);
});