Skip to content

Commit f1c17ef

Browse files
authored
fix: apply fix line endings to code and output in two spots (#68)
1 parent 70bc21b commit f1c17ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/plugin-tester.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function pluginTester({
188188
} else {
189189
assert.equal(
190190
result.trim(),
191-
code.trim(),
191+
fixLineEndings(code, endOfLine),
192192
'Expected output to not change, but it did',
193193
)
194194
}
@@ -224,8 +224,8 @@ function pluginTester({
224224
}
225225
}
226226

227-
function fixLineEndings(code, endOfLine, input) {
228-
return code.replace(/\r?\n/g, getReplacement())
227+
function fixLineEndings(string, endOfLine, input = string) {
228+
return String(string).replace(/\r?\n/g, getReplacement()).trim()
229229

230230
function getReplacement() {
231231
switch (endOfLine) {
@@ -356,7 +356,7 @@ const createFixtureTests = (fixturesDir, options) => {
356356

357357
assert.equal(
358358
actual.trim(),
359-
output.trim(),
359+
fixLineEndings(output, endOfLine),
360360
`actual output does not match ${fixtureOutputName}${ext}`,
361361
)
362362
})

0 commit comments

Comments
 (0)