Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -20,17 +20,17 @@
},
"license": "MIT",
"devDependencies": {
"axios": "^1.13.2",
"axios": "^1.13.4",
"dasherize": "^2.0.0",
"glob": "^10.4.2",
"runok": "^0.9.3",
"slugify": "^1.6.6"
},
"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.17.1",
"astro-breadcrumbs": "^3.3.3",
"astro-og-canvas": "^0.10.0",
"astro-rehype-relative-markdown-links": "0.18.1",
Expand Down
39 changes: 32 additions & 7 deletions src/scripts/runok.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -116,7 +117,7 @@ module.exports = {

const updatedFiles = globSync(`${destinationFolder}/**/*.md`);
for (const file of updatedFiles) {
if (['index', 'php', 'python'].includes(path.basename(file, '.md'))) continue;
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();
Expand All @@ -139,6 +140,36 @@ 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, './');

// 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`;

// 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, '');
Expand All @@ -151,12 +182,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() {
Expand Down