From 1a2c44c9c2215e98fdc12d729ad15b92b8a8dfe6 Mon Sep 17 00:00:00 2001 From: Arhell Date: Thu, 29 Jan 2026 00:56:43 +0200 Subject: [PATCH 1/5] Add examples section to reporter docs --- .github/workflows/test-build.yml | 2 +- astro.config.mjs | 1 + package.json | 8 +++---- src/scripts/runok.cjs | 38 ++++++++++++++++++++++++++------ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 524b5aaa..dbbc8cc7 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -17,7 +17,7 @@ jobs: node-version: 20.x - uses: pnpm/action-setup@v4 with: - version: 10.28.0 + version: 10.28.2 - run: pnpm install - run: cd src/scripts && pnpm install - run: cd src/scripts && node runok.cjs docs diff --git a/astro.config.mjs b/astro.config.mjs index 8b08c015..f59dfb72 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -208,6 +208,7 @@ export default defineConfig({ label: 'Test Reporting', items: [ { label: 'Overview', link: '/test-reporting'}, + { label: 'Testomat.io Reporter', link: '/test-reporting/reporter'}, { label: 'NodeJS Test Frameworks', link: '/test-reporting/frameworks'}, { label: 'PHP Test Frameworks', link: '/test-reporting/php'}, { label: 'Python Test Frameworks', link: '/test-reporting/python'}, diff --git a/package.json b/package.json index 820c1e29..66678887 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@testomatio/docs", "version": "0.0.1", - "packageManager": "pnpm@10.28.0", + "packageManager": "pnpm@10.28.2", "description": "Testomatio Documentation", "main": "index.js", "authors": { @@ -20,7 +20,7 @@ }, "license": "MIT", "devDependencies": { - "axios": "^1.13.2", + "axios": "^1.13.4", "dasherize": "^2.0.0", "glob": "^10.4.2", "runok": "^0.9.3", @@ -28,9 +28,9 @@ }, "dependencies": { "@astrojs/markdown-remark": "^6.3.10", - "@astrojs/starlight": "^0.37.2", + "@astrojs/starlight": "^0.37.4", "@octokit/core": "^5.1.0", - "astro": "^5.16.9", + "astro": "^5.16.16", "astro-breadcrumbs": "^3.3.3", "astro-og-canvas": "^0.10.0", "astro-rehype-relative-markdown-links": "0.18.1", diff --git a/src/scripts/runok.cjs b/src/scripts/runok.cjs index 7632bff3..76fcbfc8 100644 --- a/src/scripts/runok.cjs +++ b/src/scripts/runok.cjs @@ -71,6 +71,7 @@ module.exports = { execSync('rm -rf tmp/php-reporter'); execSync('rm -rf tmp/pytest-reporter'); + // Note: Ensure this path is correct for your environment (use relative path 'src/content/...' if __dirname causes issues) const destinationFolder = path.resolve(path.join(__dirname, '../content/docs/test-reporting')); console.log(destinationFolder); @@ -116,7 +117,9 @@ module.exports = { const updatedFiles = globSync(`${destinationFolder}/**/*.md`); for (const file of updatedFiles) { - if (['index', 'php', 'python'].includes(path.basename(file, '.md'))) continue; + // Updated: Added 'reporter' to the skip list + if (['index', 'php', 'python', 'reporter'].includes(path.basename(file, '.md'))) continue; + let title = humanize(path.basename(file, '.md')).trim(); title[0] = title[0].toUpperCase(); const titleId = title.toUpperCase(); @@ -139,6 +142,33 @@ module.exports = { fs.writeFileSync(file, contents) } + // --- New Logic for Reporter.md --- + try { + const jsReporterUrl = 'https://raw.githubusercontent.com/testomatio/reporter/refs/heads/2.x/README.md'; + const jsReporterResponse = await axios.get(jsReporterUrl); + let jsReporterContents = jsReporterResponse.data.toString(); + + // Clean up title + jsReporterContents = jsReporterContents.replace(/^#\s.+/gm, ''); + + // Remove any existing frontmatter + jsReporterContents = jsReporterContents.replace(/^---[\s\S]+?^---/m, ''); + + // Fix links: ./docs/ -> ./ + jsReporterContents = jsReporterContents.replace(/\.\/docs\//g, './'); + + // Add Note + jsReporterContents = `\n\n:::note\n Taken from [JS Reporter Readme](https://github.com/testomatio/reporter)\n:::\n\n${jsReporterContents}\n`; + + // Write File with Headers + const jsHeader = fileHeaders.reporter || '---\ntitle: Testomat.io Reporter\n---'; + fs.writeFileSync(path.join(destinationFolder, 'reporter.md'), jsHeader + jsReporterContents); + console.log('✅ Saved reporter.md'); + } catch (err) { + console.error('Failed to process reporter.md', err.message); + } + // --------------------------------- + let phpContents = fs.readFileSync(phpReadme).toString().replace(/^#\s.+/gm, ''); phpContents = phpContents.replace(/^---[\s\S]+?^---/m, ''); phpContents = phpContents.replace(/^#\s.+/gm, ''); @@ -151,12 +181,6 @@ module.exports = { pytestContents = `\n\n:::note\n Taken from [Pytestomatio Reporter Readme](${pytestReporterUrl})\n:::\n\n${pytestContents}\n` fs.writeFileSync(path.join(destinationFolder, '/python.md'), fileHeaders.python + pytestContents) - // writeToFile(destinationFolder + '/python.md', cfg => { - // cfg.line(fileHeaders.python || '---\nPython Reporter\n---'); - // cfg.line(pytestContents); - // }); - - }, async docsImporter() { From d7c4006e41f8f8f9846ee5b3e19a43d94cd28404 Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 30 Jan 2026 03:14:54 +0200 Subject: [PATCH 2/5] Add examples section to reporter docs --- package.json | 2 +- src/scripts/runok.cjs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 66678887..63b7f5ab 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@astrojs/markdown-remark": "^6.3.10", "@astrojs/starlight": "^0.37.4", "@octokit/core": "^5.1.0", - "astro": "^5.16.16", + "astro": "^5.17.1", "astro-breadcrumbs": "^3.3.3", "astro-og-canvas": "^0.10.0", "astro-rehype-relative-markdown-links": "0.18.1", diff --git a/src/scripts/runok.cjs b/src/scripts/runok.cjs index 76fcbfc8..968f7003 100644 --- a/src/scripts/runok.cjs +++ b/src/scripts/runok.cjs @@ -117,9 +117,7 @@ module.exports = { const updatedFiles = globSync(`${destinationFolder}/**/*.md`); for (const file of updatedFiles) { - // Updated: Added 'reporter' to the skip list if (['index', 'php', 'python', 'reporter'].includes(path.basename(file, '.md'))) continue; - let title = humanize(path.basename(file, '.md')).trim(); title[0] = title[0].toUpperCase(); const titleId = title.toUpperCase(); @@ -157,6 +155,9 @@ module.exports = { // Fix links: ./docs/ -> ./ jsReporterContents = jsReporterContents.replace(/\.\/docs\//g, './'); + // Fix specific pipe link + jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes/index.md)'); + // Add Note jsReporterContents = `\n\n:::note\n Taken from [JS Reporter Readme](https://github.com/testomatio/reporter)\n:::\n\n${jsReporterContents}\n`; From f52aeb457814de4915be35bf7ed67b5f531754f7 Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 30 Jan 2026 03:29:56 +0200 Subject: [PATCH 3/5] Add examples section to reporter docs --- src/scripts/runok.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/runok.cjs b/src/scripts/runok.cjs index 968f7003..3fceb2ec 100644 --- a/src/scripts/runok.cjs +++ b/src/scripts/runok.cjs @@ -156,7 +156,7 @@ module.exports = { jsReporterContents = jsReporterContents.replace(/\.\/docs\//g, './'); // Fix specific pipe link - jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes/index.md)'); + jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes)'); // Add Note jsReporterContents = `\n\n:::note\n Taken from [JS Reporter Readme](https://github.com/testomatio/reporter)\n:::\n\n${jsReporterContents}\n`; From 587bbc08207975f883a49ad923e7f90e0e2fcd74 Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 30 Jan 2026 03:44:28 +0200 Subject: [PATCH 4/5] Add examples section to reporter docs --- src/scripts/runok.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/runok.cjs b/src/scripts/runok.cjs index 3fceb2ec..1261aa4c 100644 --- a/src/scripts/runok.cjs +++ b/src/scripts/runok.cjs @@ -156,7 +156,7 @@ module.exports = { jsReporterContents = jsReporterContents.replace(/\.\/docs\//g, './'); // Fix specific pipe link - jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes)'); + jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes/index.mdx)'); // Add Note jsReporterContents = `\n\n:::note\n Taken from [JS Reporter Readme](https://github.com/testomatio/reporter)\n:::\n\n${jsReporterContents}\n`; From 56c9476bb7066c98930e0c868379c4015d61dc99 Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 30 Jan 2026 03:59:16 +0200 Subject: [PATCH 5/5] Add examples section to reporter docs --- src/scripts/runok.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/runok.cjs b/src/scripts/runok.cjs index 1261aa4c..f8b95dfd 100644 --- a/src/scripts/runok.cjs +++ b/src/scripts/runok.cjs @@ -155,8 +155,8 @@ module.exports = { // Fix links: ./docs/ -> ./ jsReporterContents = jsReporterContents.replace(/\.\/docs\//g, './'); - // Fix specific pipe link - jsReporterContents = jsReporterContents.replace(/\[pipes\]\(\.\/pipes\.md\)/g, '[pipes](./pipes/index.mdx)'); + // Fix specific pipe link (handles [pipes] and [Pipes]) + jsReporterContents = jsReporterContents.replace(/\[(Pipes|pipes)\]\(\.\/pipes\.md\)/g, '[$1](./pipes/index.mdx)'); // Add Note jsReporterContents = `\n\n:::note\n Taken from [JS Reporter Readme](https://github.com/testomatio/reporter)\n:::\n\n${jsReporterContents}\n`;