From 5f24329fa5587620efa09ef5db70768b9f91d197 Mon Sep 17 00:00:00 2001 From: Brandon Ramirez Date: Thu, 2 May 2024 19:08:13 -0500 Subject: [PATCH] Write test file directly because grunt keeps getting EEXIST errors from mkdir. --- test/unit-tests.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit-tests.js b/test/unit-tests.js index 2d7f2ea..28ef9ae 100644 --- a/test/unit-tests.js +++ b/test/unit-tests.js @@ -1,3 +1,4 @@ +const fs = require('fs'); const grunt = require('grunt'); const jsonlint = require('@prantlf/jsonlint'); const validator = require('@prantlf/jsonlint/lib/validator'); @@ -265,11 +266,12 @@ function testReformattingFile(indent) { } // Build an unformatted file for testing. - grunt.file.write(`${__dirname}/reformat-this.json`, '{"somethingsomething":"something","something":"dark side"}'); + fs.writeFileSync(`${__dirname}/reformat-this.json`, '{"somethingsomething":"something","something":"dark side"}'); runWithFiles(grunt, jsonlint, [ 'test/reformat-this.json' ], options); - const formatted = grunt.file.read(`${__dirname}/reformat-this.json`); + // const formatted = grunt.file.read(`${__dirname}/reformat-this.json`); + const formatted = fs.readFileSync(`${__dirname}/reformat-this.json`); const lines = formatted.split(/\r?\n/); expect(lines).to.have.length(5); expect(lines[0]).to.be('{');