From c3e95ef1d5fda062e86f37ee5c16c636da19b248 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Tue, 18 Feb 2025 13:18:30 +0100 Subject: [PATCH] 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 --- .../guides/testing/mermaid/mermaid.md | 14 ------------- .../guides/testing/mermaid/mermaid.spec.ts | 21 ++++++++++++++++--- 2 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.md diff --git a/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.md b/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.md deleted file mode 100644 index 56daf442821..00000000000 --- a/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.md +++ /dev/null @@ -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 -``` \ No newline at end of file diff --git a/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.spec.ts b/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.spec.ts index fe9d2247662..3e09ad504e2 100644 --- a/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.spec.ts +++ b/adev/shared-docs/pipeline/guides/testing/mermaid/mermaid.spec.ts @@ -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,