From 7efe9c1a0d3cc90a6e4a9743341fdec6ad35b87e Mon Sep 17 00:00:00 2001 From: Ravi van Rooijen Date: Fri, 4 Aug 2023 22:44:21 +0200 Subject: [PATCH] Fix EOL mismatch resulting in false negative test result (#94) --- test/test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index cadd050..47c4a7b 100644 --- a/test/test.js +++ b/test/test.js @@ -139,13 +139,13 @@ function testInput(input) { it('output should produce the same output as output file', () => { const outputFilePath = path.join(outputPath, input.output); - const fileContent = JSON.stringify(sortObject(converted), null, 2) + '\n'; + const fileContent = sortObject(converted); if (process.env.WRITE_CONVERTED) { - fs.writeFileSync(outputFilePath, fileContent); + fs.writeFileSync(outputFilePath, JSON.stringify(fileContent, null, 2) + '\n'); } - const outputFile = fs.readFileSync(outputFilePath, 'utf-8'); + const outputFile = JSON.parse(fs.readFileSync(outputFilePath, 'utf-8')); expect(fileContent).to.deep.equal(outputFile); }); });