← 输入框|github.com|刷新
Skip to content

fix: migrate test suite from tap to node:test - #76

Merged
simoneb merged 3 commits into
fastify:mainfrom
nearform:fix/migrate-to-node-test
Sep 6, 2024
Merged

simoneb merged 3 commits into
fastify:mainfrom
nearform:fix/migrate-to-node-test

Conversation

@nimesh0505

Copy link
Copy Markdown
Contributor

This PR replaces tap with node:test and introduces c8 for code coverage.

Checklist

@nimesh0505
nimesh0505 marked this pull request as draft September 5, 2024 07:58
@nimesh0505
nimesh0505 force-pushed the fix/migrate-to-node-test branch from e913a6b to 6e75e21 Compare September 5, 2024 07:59
@nimesh0505
nimesh0505 marked this pull request as ready for review September 5, 2024 07:59
@nimesh0505
nimesh0505 marked this pull request as draft September 5, 2024 08:14
@simoneb

simoneb commented Sep 5, 2024

Copy link
Copy Markdown

Do we need c8 or can we use the built-in coverage? https://nodejs.org/api/test.html#collecting-code-coverage

@nimesh0505

nimesh0505 commented Sep 5, 2024 •

Copy link
Copy Markdown
Contributor Author

Do we need c8 or can we use the built-in coverage? https://nodejs.org/api/test.html#collecting-code-coverage

@simoneb Thanks for suggesting the use of Node.js's built-in coverage. After consideration, I think we should stick with c8 for now. Here's why:

  1. The --experimental-test-coverage flag is still experimental, which could lead to instability or changes in future Node.js versions.
  2. As a widely-used package, @fastify/pre-commit should prioritize stability for its users.
  3. c8 is a mature, stable solution that we know works well across different Node.js versions.

However, I agree it's a good idea to eventually move to the built-in coverage. I suggest we:

  1. Keep using c8 for now.
  2. May be create an issue to track the eventual migration to Node.js's built-in coverage.
  3. Revisit this once the coverage feature in Node.js becomes stable (likely when they remove the experimental prefix).

This way, we maintain stability for our users while staying prepared to adopt the built-in solution when it's ready. What do you think?

@simoneb

simoneb commented Sep 5, 2024

Copy link
Copy Markdown

Sounds good, I brought it up in case other maintainers have an opinion on this

@mcollina

mcollina commented Sep 5, 2024

Copy link
Copy Markdown
Member

Use c8 for now.

Comment thread test.js Outdated
t.plan(1)
t.strictSame(typeof Hook, 'function')
test('pre-commit', async (t) => {
await t.test('is exported as a function', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you change to use the built-in t.plan and t.assert?

@nimesh0505
nimesh0505 force-pushed the fix/migrate-to-node-test branch from 3c5eb5c to 1658fd3 Compare September 6, 2024 11:00
@nimesh0505
nimesh0505 marked this pull request as ready for review September 6, 2024 11:24
@simoneb
simoneb merged commit a625b62 into fastify:main Sep 6, 2024
@nimesh0505
nimesh0505 deleted the fix/migrate-to-node-test branch September 6, 2024 13:37
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants