Skip to content

Commit

Permalink
Write test file directly because grunt keeps getting EEXIST errors fr…
Browse files Browse the repository at this point in the history
…om mkdir.
  • Loading branch information
brandonramirez committed May 3, 2024
1 parent bb94486 commit 793ae50
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit-tests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs');
const grunt = require('grunt');
const jsonlint = require('@prantlf/jsonlint');
const validator = require('@prantlf/jsonlint/lib/validator');
Expand Down Expand Up @@ -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"}', 'utf8');

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`, 'utf8');
const lines = formatted.split(/\r?\n/);
expect(lines).to.have.length(5);
expect(lines[0]).to.be('{');
Expand Down

0 comments on commit 793ae50

Please sign in to comment.