Skip to content

Commit a0a5162

Browse files
committed
test: fix tests requiring git core.autocrlf=true on windows
Signed-off-by: Nad Alaba <37968805+nadalaba@users.noreply.github.com>
1 parent 6e2188e commit a0a5162

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

test/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ directory, see [the guide on writing tests](../doc/contributing/writing-tests.md
88
On how to run tests in this directory, see
99
[the contributing guide](../doc/contributing/pull-requests.md#step-6-test).
1010

11-
For the tests to run on Windows, be sure to clone Node.js source code with the
12-
`autocrlf` git config flag set to true.
13-
1411
## Test Directories
1512

1613
| Directory | Runs on CI | Purpose |

test/parallel/test-snapshot-typescript.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ const { spawnSync } = require('child_process');
99
const tmpdir = require('../common/tmpdir');
1010
const fixtures = require('../common/fixtures');
1111
const fs = require('fs');
12+
const os = require('os');
1213

1314
tmpdir.refresh();
1415
const blobPath = tmpdir.resolve('snapshot.blob');
1516

1617
// Concat test/fixtures/snapshot/typescript.js with
17-
// test/fixtures/snapshot/typescript.js into
18+
// test/fixtures/snapshot/typescript-main.js into
1819
// tmpdir/snapshot.js.
1920
const file = tmpdir.resolve('snapshot.js');
2021
fs.copyFileSync(fixtures.path('snapshot', 'typescript.js'), file);
@@ -57,7 +58,8 @@ fs.appendFileSync(file,
5758

5859
assert.strictEqual(child.status, 0);
5960
const result = fs.readFileSync(outPath, 'utf8');
60-
const expected = fs.readFileSync(
61-
fixtures.path('snapshot', 'ts-example.js'), 'utf8');
61+
const expected = fs
62+
.readFileSync(fixtures.path('snapshot', 'ts-example.js'), 'utf8')
63+
.replace(/\r?\n/g, os.EOL);
6264
assert.strictEqual(result, expected);
6365
}

0 commit comments

Comments
 (0)