Skip to content

Commit

Permalink
Simplify assertions to handle Node version difference
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Mar 28, 2024
1 parent 2a11ca3 commit 3cce856
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node-src/lib/getConfiguration.test.ts
Expand Up @@ -156,19 +156,19 @@ it('errors if config file is unparseable', async () => {
{
mockedReadFile.mockReturnValue('invalid json');
await expect(getConfiguration('test.file')).rejects.toThrow(
/Configuration file .+ could not be parsed(.|\n)*Unexpected token i in JSON/
/Configuration file .+ could not be parsed(.|\n)*Unexpected token/
);
}
{
mockedReadFile.mockReturnValue('{ "foo": 1 "unexpectedString": 2 }');
await expect(getConfiguration('test.file')).rejects.toThrow(
/Configuration file .+ could not be parsed(.|\n)*Unexpected string in JSON/m
/Configuration file .+ could not be parsed(.|\n)*Unexpected string/m
);
}
{
mockedReadFile.mockReturnValue('{ "unexpectedEnd": ');
await expect(getConfiguration('test.file')).rejects.toThrow(
/Configuration file .+ could not be parsed(.|\n)*Unexpected end of JSON input/m
/Configuration file .+ could not be parsed(.|\n)*Unexpected end/m
);
}
});

0 comments on commit 3cce856

Please sign in to comment.