test: fix ts api guardian and public guard tests on windows (#30105)

This change addresses several issues with ts-api-guardian and public api guards related tests in Windows

The fixes contain 3 main changes:
1) In `stripExportPattern` - replace `^` with `^^^^`  in RegExp due to a double escaping requirment under Windows. Note that under Linux this the extra character has no effect because it's still a valid RegExp in Js.

2. Force `*.patch` files to always be with a LF line sequence instead of CRLF in windows

3. When adding JSDoc comments consider the presence of a carriage return in a line new feed

Partially addresses #29785

PR Close #30105
This commit is contained in:
Alan Agius
2019-04-25 10:37:41 +02:00
committed by Andrew Kushnir
parent f2709ac3f9
commit 5f95796b61
3 changed files with 6 additions and 2 deletions

View File

@ -298,7 +298,7 @@ class ResolvedDeclarationEmitter {
const jsdocComment = this.processJsDocTags(node, tagOptions);
if (jsdocComment) {
// Add the annotation after the leading whitespace
output = output.replace(/^(\n\s*)/, `$1${jsdocComment} `);
output = output.replace(/^(\r?\n\s*)/, `$1${jsdocComment} `);
}
}