mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-29 06:29:03 +02:00
test: improve test coverage (#7113)
This commit is contained in:
parent
4194925da9
commit
e610a4ac00
17 changed files with 235 additions and 61 deletions
|
@ -83,18 +83,16 @@ export async function readOutputHTMLFile(
|
|||
outDir,
|
||||
`${permalink.replace(/\/$/, '')}.html`,
|
||||
);
|
||||
if (trailingSlash) {
|
||||
return fs.readFile(withTrailingSlashPath);
|
||||
} else if (trailingSlash === false) {
|
||||
return fs.readFile(withoutTrailingSlashPath);
|
||||
}
|
||||
const HTMLPath = await findAsyncSequential(
|
||||
[withTrailingSlashPath, withoutTrailingSlashPath],
|
||||
[
|
||||
trailingSlash !== false && withTrailingSlashPath,
|
||||
trailingSlash !== true && withoutTrailingSlashPath,
|
||||
].filter((p): p is string => Boolean(p)),
|
||||
fs.pathExists,
|
||||
);
|
||||
if (!HTMLPath) {
|
||||
throw new Error(
|
||||
`Expected output HTML file to be found at ${withTrailingSlashPath}`,
|
||||
`Expected output HTML file to be found at ${withTrailingSlashPath}.`,
|
||||
);
|
||||
}
|
||||
return fs.readFile(HTMLPath);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue