test(language-service): [ivy] remove all markers from test (#38777)

In the test project there are no longer reference markers and location
markers, so there's no need to "pre-process" the source files to remove
them. This will make the Ivy tests cleaner and faster.

PR Close #38777
This commit is contained in:
Keen Yee Liau 2020-09-09 14:59:02 -07:00 committed by atscott
parent a69507a0ad
commit c6ebb77cec

View File

@ -45,14 +45,7 @@ export const host: ts.server.ServerHost = {
...ts.sys, ...ts.sys,
readFile(absPath: string, encoding?: string): string | readFile(absPath: string, encoding?: string): string |
undefined { undefined {
const content = ts.sys.readFile(absPath, encoding); return ts.sys.readFile(absPath, encoding);
if (content === undefined) {
return undefined;
}
if (absPath === APP_COMPONENT || absPath === PARSING_CASES || absPath === TEST_TEMPLATE) {
return removeReferenceMarkers(removeLocationMarkers(content));
}
return content;
}, },
watchFile(path: string, callback: ts.FileWatcherCallback): ts.FileWatcher { watchFile(path: string, callback: ts.FileWatcherCallback): ts.FileWatcher {
return NOOP_FILE_WATCHER; return NOOP_FILE_WATCHER;
@ -206,14 +199,3 @@ function replaceOnce(searchText: string, regex: RegExp, replaceText: string): Ov
}); });
return {position, text}; return {position, text};
} }
const REF_MARKER = /«(((\w|\-)+)|([^ᐱ]*ᐱ(\w+)ᐱ.[^»]*))»/g;
const LOC_MARKER = /\~\{(\w+(-\w+)*)\}/g;
function removeReferenceMarkers(value: string): string {
return value.replace(REF_MARKER, '');
}
function removeLocationMarkers(value: string): string {
return value.replace(LOC_MARKER, '');
}