Skip to content

Commit

Permalink
test(read-project-manifest): fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Nov 2, 2022
1 parent cd38822 commit 5b50974
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/read-project-manifest/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ test('fail on invalid JSON', async () => {
expect(err).toBeTruthy()
expect(err['code']).toBe('ERR_PNPM_JSON_PARSE')

expect(err.message).toContain('Unexpected string in JSON at position 20 while parsing \'{ "name": "foo" "version": "1.0.0"}\' in ')
const nodeMajorVersion = parseInt(process.version.slice(1).split('.')[0])
const expectedMessage = nodeMajorVersion >= 19
? 'Expected \',\' or \'}\' after property value in JSON at position 20 while parsing \'{ "name": "foo" "version": "1.0.0"}\' in'
: 'Unexpected string in JSON at position 20 while parsing \'{ "name": "foo" "version": "1.0.0"}\' in '
expect(err.message).toContain(expectedMessage)
})

test('fail on invalid JSON5', async () => {
Expand Down

0 comments on commit 5b50974

Please sign in to comment.