Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 2d2f559

Browse files
Akimnahsi
andauthored
chore: Fix test with node 18/20 error message (#323)
* Fix test with node 18/20 error message * Run tests on node 18 and 20 * Enhance description * Fix type and obj property --------- Co-authored-by: Anatoly Laskaris <[email protected]>
1 parent c99a509 commit 2d2f559

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
matrix:
3939
node-version:
4040
- 18.x
41-
# - 20.x
41+
- 20.x
4242

4343
steps:
4444
- name: Import secrets

packages/core/js-peer/src/services/__test__/builtInHandler.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ describe('Tests for default handler', () => {
129129
// act
130130
const fn = builtInServices[req.serviceId][req.fnName];
131131
const res = await fn(req);
132+
133+
// Our test cases above depend on node error message. In node 20 error message for JSON.parse has changed.
134+
// Simple and fast solution for this specific case is to unify both variations into node 18 version error format.
135+
if (res.result === 'Unexpected token \'i\', "incorrect" is not valid JSON') {
136+
res.result = 'Unexpected token i in JSON at position 0';
137+
}
132138

133139
// assert
134140
expect(res).toMatchObject({

0 commit comments

Comments
 (0)