Skip to content

Commit

Permalink
fix: also replace \r in string whitespace (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Feb 8, 2023
1 parent 6918c2f commit 19ac77e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rules/expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ function getNodeAtPosition(sourceFile: ts.SourceFile, position: number): ts.Node
function matchModuloWhitespace(actual: string, expected: string): boolean {
// TODO: it's much easier to normalize actual based on the displayParts
// This isn't 100% correct if a type has a space in it, e.g. type T = "string literal"
const normActual = actual.replace(/[\n ]+/g, ' ').trim();
const normExpected = expected.replace(/[\n ]+/g, ' ').trim();
const normActual = actual.replace(/[\n\r ]+/g, ' ').trim();
const normExpected = expected.replace(/[\n\r ]+/g, ' ').trim();
return normActual === normExpected;
}

Expand Down

0 comments on commit 19ac77e

Please sign in to comment.