Skip to content

Commit 3066cdd

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 a24bd27 commit 3066cdd

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎.github/workflows/coverage-windows.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ permissions:
6868
jobs:
6969
coverage-windows:
7070
if: github.event.pull_request.draft == false
71+
strategy:
72+
matrix:
73+
autocrlf: [true, false]
7174
runs-on: windows-2025
7275
steps:
76+
- name: Set git config core.autocrlf
77+
run: git config --global core.autocrlf ${{ matrix.autocrlf }}
7378
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
7479
with:
7580
persist-credentials: false

‎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)