docs(docs-infra): attemp to fix flaky mermaid test (#59994)

This test has 2 async parts, loading the markdown file and the marked parsing.
First attempt to fix the flakiness is by inline the markdown file.

If this test timeouts again in the future it means the timeout is related to marked itself (and the dynamic import of mermaid).

PR Close #59994
This commit is contained in:
Matthieu Riegler 2025-02-18 13:18:30 +01:00 committed by Jessica Janiuk
parent 5b20bab96d
commit c3e95ef1d5
2 changed files with 18 additions and 17 deletions

View file

@ -1,14 +0,0 @@
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
```mermaid
pie title Pets adopted by volunteers
"Dogs" : 386
"Cats" : 85
"Rats" : 15
```

View file

@ -20,9 +20,24 @@ describe('markdown to html', () => {
// Extend the timeout interval tyo 15 seconds because we were seeing issues with not being able to run marked
// within the default timeframe.
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
const markdownContent = await readFile(runfiles.resolvePackageRelative('./mermaid.md'), {
encoding: 'utf-8',
});
// This test was flaky, 1st attemp to fix it is by inlining the markdown content
const markdownContent = `
\`\`\`mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
\`\`\`
\`\`\`mermaid
pie title Pets adopted by volunteers
"Dogs" : 386
"Cats" : 85
"Rats" : 15
\`\`\`
`;
marked.use({
async: true,