Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: also replace \r in string whitespace #73

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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