test(docs-infra): ignore empty lines in `URLS_TO_REDIRECT.txt` (#41680)
Previously, the `URLS_TO_REDIRECT.txt` file was expected to not contain any empty lines. This could easily result in test errors when updating the file, since it is common for IDEs/editors to automatically ensure there is an empty line at the end of a saved file ([example failure][1]). This commit updates the test helpers to be able to cope with empty or whitespace-only lines in `URLS_TO_REDIRECT.txt` by ignoring such lines. [1]: https://circleci.com/gh/angular/angular/965534 PR Close #41680
This commit is contained in:
parent
3738dbba05
commit
1d6af94cfb
|
@ -194,4 +194,4 @@
|
||||||
/start/forms /start/start-forms
|
/start/forms /start/start-forms
|
||||||
/start/routing /start/start-routing
|
/start/routing /start/start-routing
|
||||||
/testing /guide/testing
|
/testing /guide/testing
|
||||||
/testing/first-app-tests.html /guide/testing
|
/testing/first-app-tests.html /guide/testing
|
||||||
|
|
|
@ -41,7 +41,10 @@ export function loadRedirects(): FirebaseRedirectConfig[] {
|
||||||
|
|
||||||
export function loadLegacyUrls() {
|
export function loadLegacyUrls() {
|
||||||
const pathToLegacyUrls = `${__dirname}/URLS_TO_REDIRECT.txt`;
|
const pathToLegacyUrls = `${__dirname}/URLS_TO_REDIRECT.txt`;
|
||||||
const urls = readFileSync(pathToLegacyUrls, 'utf8').split('\n').map(line => line.split('\t'));
|
const urls = readFileSync(pathToLegacyUrls, 'utf8')
|
||||||
|
.split('\n')
|
||||||
|
.filter(line => line.trim() !== '')
|
||||||
|
.map(line => line.split('\t'));
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue