Skip to content

Commit 9dcfb85

Browse files
TomerFicursoragent
andauthored
fix: replace os.EOL with hardcoded newline for cross-platform compatibility (#809)
On Windows, os.EOL returns \r\n which causes test failures because third-party libraries (marked, commitlint) normalize line endings to \n internally. Since the bot runs on Lambda (Linux) and outputs GitHub Markdown, \n is the correct line ending in all cases. Closes #54 Signed-off-by: Tomer Figenblat <tomer@figenblat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ba75e6e commit 9dcfb85

File tree

9 files changed

+14
-10
lines changed

9 files changed

+14
-10
lines changed

.github/workflows/pr.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
12-
name: Lint and test project
11+
runs-on: ${{ matrix.os }}
12+
name: Lint and test project (${{ matrix.os }})
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest]
1316
steps:
1417
- name: Checkout sources
1518
uses: actions/checkout@v6
@@ -30,6 +33,7 @@ jobs:
3033
run: npm test
3134

3235
- name: Upload coverage to Codecov
36+
if: matrix.os == 'ubuntu-latest'
3337
uses: codecov/codecov-action@v5
3438
with:
3539
token: ${{ secrets.CODECOV_TOKEN }}

src/handlers/pr-conventional-commits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import lint from '@commitlint/lint'
22
import load from '@commitlint/load'
3-
import { EOL } from 'node:os'
3+
const EOL = '\n'
44

55
/* example configuration (for reference):
66
rules:

src/handlers/pr-conventional-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import lint from '@commitlint/lint'
22
import load from '@commitlint/load'
3-
import { EOL } from 'node:os'
3+
const EOL = '\n'
44

55
/* example configuration (for reference):
66
rules:

src/handlers/pr-signed-commits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EOL } from 'node:os'
1+
const EOL = '\n'
22
import validator from 'validator';
33

44
/* example configuration (for reference):

src/handlers/pr-tasks-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { marked } from 'marked'
2-
import { EOL } from 'node:os'
2+
const EOL = '\n'
33

44
const BOT_CHECK_URL = 'https://auto-me-bot.figenblat.com';
55
const CHECK_NAME = 'Auto-Me-Bot Tasks List';

tests/handlers/pr-conventional-commits.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, use as chaiUse } from 'chai'
22
import sinonChai from 'sinon-chai'
33
import sinon from 'sinon'
44
import { beforeEach } from 'mocha'
5-
import { EOL } from 'node:os'
5+
const EOL = '\n'
66

77
chaiUse(sinonChai)
88

tests/handlers/pr-conventional-title.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, use as chaiUse } from 'chai'
22
import sinonChai from 'sinon-chai'
33
import sinon from 'sinon'
44
import { beforeEach } from 'mocha'
5-
import { EOL } from 'node:os'
5+
const EOL = '\n'
66

77
chaiUse(sinonChai)
88

tests/handlers/pr-signed-commits.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, use as chaiUse } from 'chai'
22
import sinonChai from 'sinon-chai'
33
import sinon from 'sinon'
44
import { beforeEach } from 'mocha'
5-
import { EOL } from 'node:os'
5+
const EOL = '\n'
66
import { cloneDeep } from 'lodash-es'
77

88
chaiUse(sinonChai)

tests/handlers/pr-tasks-list.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, use as chaiUse } from 'chai'
22
import sinonChai from 'sinon-chai'
33
import sinon from 'sinon'
44
import { beforeEach } from 'mocha'
5-
import { EOL } from 'node:os'
5+
const EOL = '\n'
66

77
chaiUse(sinonChai)
88

0 commit comments

Comments
 (0)