Skip to content

Conversation

@aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 17, 2026

We don't have any validation for the JSON output of the docs, errors can easily slip up there. Those tests become more important to gain confidence to switch a different system to generate those.

It's also a way to enforce consistency as demonstrated by the Markdown change in this PR.

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jan 17, 2026
@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (79ddd1b) to head (6519805).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61413      +/-   ##
==========================================
- Coverage   88.53%   88.52%   -0.02%     
==========================================
  Files         704      704              
  Lines      208876   208883       +7     
  Branches    40330    40338       +8     
==========================================
- Hits       184937   184904      -33     
- Misses      15922    15969      +47     
+ Partials     8017     8010       -7     

see 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM!

if (dirent.name !== 'index.md') {
assert.ok(json.introduced_in || Object.values(json).at(-1)?.[0].introduced_in);
}
assert.deepStrictEqual(Object.keys(json), ['type', 'source', ...({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this change over time as more api files are added? Should we document that somewhere?

@nodejs-github-bot
Copy link
Collaborator

Comment on lines +128 to +131
const fileContent = await fs.readFile(jsonPath, 'utf8');
// A proxy to check if the file is human readable is to count if it contains
// at least 3 line return.
assert.strictEqual(fileContent.split('\n', 3).length, 3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this check, it seems unnecessary, as this is a JSON file.

Copy link
Contributor Author

@aduh95 aduh95 Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can agree to disagree. Having the output JSON human readable is very much useful to review it. (If you meant that line returns are not a good proxy for human readable, I'm open to suggestions)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, we don't review the generated JSON manually during PRs, right? It's not even on git diffs, afaik?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to my understanding, not prettyifying them saves lots of network bandwidth and decreases file size by 70-80%, I think you can still use browsers or tools that automatically prettify'em if you want to visualize the JSON manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be surprised if that was the case, empty spaces are very compressible, gzipped size should be almost the same

Comment on lines +11 to +13
if (common.isWindows) {
common.skip('`make doc` does not run on Windows');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, can we check if the files exist, because if this test is run on Windows in a space where those files do exist, IMO we should test them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it from

common.skip('`make doc` does not run on Windows');

We should keep both consistent IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know make doc doesn't run on Windows too, doc-kit should work on Windows tho. But I assume it is skipped on Windows CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants