Skip to content

Conversation

@dubzzz
Copy link
Contributor

@dubzzz dubzzz commented Feb 2, 2026

This PR proposes to add some tests using property based testing to the project.

Why?

The idea behind property based testing is that uncovering all bugs and edge-cases is often impossible as one cannot think of all of them. With this technique in place, developers can rely on the framework to find the issue without to think about all possible dangerous combinations that could exist.

Contrary to using random values in tests, property based tests are deterministic and reproducible as everything relies on a seed.

It may have found a bug...

The tests on parseJsDocLinks that I added are failing. Before trying to fix anything (the code or the test) I wanted to get a few insights from people knowing this piece of code.

Current failure is for a text being: {@link http://a.aa/&}.

More

Last point, adding a native support to Vitest is (by far) the most upvoted idea at the moment: vitest-dev/vitest#2212. While waiting for that to be true, we can use @fast-check/vitest.

@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.npmx.dev Error Error Feb 3, 2026 9:26am
npmx.dev Ready Ready Preview, Comment Feb 3, 2026 9:26am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Feb 3, 2026 9:26am

Request Review

it('not run more than concurrency tasks in parallel', async () => {
await fc.assert(
fc.asyncProperty(
fc.array(fc.anything()), // TODO, support failing tasks too
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 have not implemented the failing task part yet, but if the idea of adding property based testing to this repository feels sane I can work on adding this failure case (probably into a distinct test case mixing successes and failures but having a different expectation - highly depends on the behavior expected in case of failure)

@dubzzz
Copy link
Contributor Author

dubzzz commented Feb 2, 2026

@43081j @danielroe Given we discussed of the idea together on Bluesky and Discord

@danielroe
Copy link
Member

danielroe commented Feb 3, 2026

I think this is correct:

http://a.aa/&

this is how vue-router renders links with & in them...

@dubzzz
Copy link
Contributor Author

dubzzz commented Feb 3, 2026

@danielroe Indeed you're right it's correct, I did the test on my browser and <a href="http://a.aa/&amp;" target="_blank" rel="noreferrer" class="docs-link">http://a.aa/&amp;</a> has the right display and lead to the right url. I'm gonna change the expectation to capture that.

@dubzzz
Copy link
Contributor Author

dubzzz commented Feb 3, 2026

Tests adapted, sorry for the false warning

@danielroe danielroe added this pull request to the merge queue Feb 3, 2026
@dubzzz
Copy link
Contributor Author

dubzzz commented Feb 3, 2026

Thanks ! I'm gonna propose other tests in the coming days.

Merged via the queue into npmx-dev:main with commit 0c03bb1 Feb 3, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants