Skip to content

Commit

Permalink
chore: normalize windows newline in fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jun 4, 2021
1 parent 491826b commit 40111cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function exec(cwd, src, flags=[]) {
return spawnSync('node', args, { cwd });
}

function normalize(contents) {
return contents.trim().replace(/\r?\n/g, '\n');
}

fs.readdirSync(fixtures).forEach(dirname => {
let dir = join(fixtures, dirname);
let expects = require( join(dir, 'expects.json') );
Expand Down Expand Up @@ -53,8 +57,8 @@ fs.readdirSync(fixtures).forEach(dirname => {
if (fs.existsSync(output)) {
output = fs.readFileSync(output, 'utf8');
assert.fixture(
data.trim(),
output.trim()
normalize(data),
normalize(output),
);
}

Expand Down

0 comments on commit 40111cf

Please sign in to comment.