Skip to content

chore: setup borp reporter for switch to node test#5720

Merged
jsumners merged 9 commits into
fastify:mainfrom
dancastillo:borp-reporter-for-tap-and-nodetest
Oct 13, 2024
Merged

chore: setup borp reporter for switch to node test#5720
jsumners merged 9 commits into
fastify:mainfrom
dancastillo:borp-reporter-for-tap-and-nodetest

Conversation

@dancastillo

Copy link
Copy Markdown
Member

Checklist

This PR install borp and adds test/test-reporter.mjs to run all tap and node:test test suites which will allow to incrementally migrate from tap to node:test.
This PR is insired from this comment #5683 (comment)

Comment thread package.json Outdated
@dancastillo dancastillo marked this pull request as draft October 1, 2024 13:27
Comment thread test/test-reporter.mjs Outdated
async function * reporter (source) {
const failed = new Set()
const diagnostics = new Set()
diagnostics.add('\n\n')

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.

Let's leave formatting of output to the display section of the code and only display diagnostic messages when any exist (as we do with failed files).

Comment thread test/test-reporter.mjs
Comment thread test/test-reporter.mjs
Comment thread package.json Outdated
@jsumners jsumners mentioned this pull request Oct 5, 2024
3 tasks
@dancastillo

Copy link
Copy Markdown
Member Author

Could this be an issue wiith borp on windows? Looks like macos and ubuntu run without issue
https://github.com/fastify/fastify/actions/runs/11236848075/job/31237887369?pr=5720

@jsumners

jsumners commented Oct 8, 2024

Copy link
Copy Markdown
Member

It's due to --reporter=test/test-reporter.mjs and https://github.com/mcollina/borp/blob/339c6915bc2a782bea1df97e297bff6121c8f801/borp.js#L115-L129

For some reason, it's getting split into test and test-reporter.mjs. And then borp tries to load node_modules/test/ as a reporter.

@jsumners

jsumners commented Oct 9, 2024

Copy link
Copy Markdown
Member

Unfortunately, I think we are going to need to extend borp to support an rc file in order to get around the various platforms's shell expansions. We should be able to write:

# .borp.yaml

reporters:
  - './test/test-reporter.mjs'

files:
  - 'test/**/*.test.js'
  - 'test/**/*.test.mjs'

@jsumners

Copy link
Copy Markdown
Member

I have started the work for adding rcfile support to borp at mcollina/borp#105. Pretty much just needs some documentation. But my work day is about to start, so it'll have to wait (feel free to add to it with other PRs).

@jsumners

Copy link
Copy Markdown
Member

@dancastillo bump borp to 0.18.0 and CI should pass.

@dancastillo dancastillo marked this pull request as ready for review October 11, 2024 18:06
Comment thread package.json Outdated
"coverage:ci": "tap --coverage-report=html --coverage-report=lcov --allow-incomplete-coverage",
"coverage:ci-check-coverage": "tap replay",
"coverage": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage --lines 100",
"coverage:ci": "nyc --coverage-report=html --coverage-report=lcov borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",

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.

We should be using c8 for coverage.

Comment thread package.json Outdated
"unit:report": "tap --coverage-report=html --coverage-report=cobertura | tee out.tap",
"citgm": "tap --jobs=1 --timeout=120"
"unit": "borp --reporter=./test/test-reporter.mjs",
"unit:report": "nyc --coverage-report=html --reporter=cobertura borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",

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.

nyc => c8

Comment thread package.json Outdated
Comment thread package.json Outdated
@dancastillo dancastillo requested a review from jsumners October 12, 2024 02:12

@jsumners jsumners left a comment

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.

Please add a .borp.yaml file with the following contents:

files:
  - 'test/**/*.test.js'
  - 'test/**/*.test.mjs'

We are missing at least one test suite without that configuration.

Comment thread package.json Outdated
"unit:report": "tap --coverage-report=html --coverage-report=cobertura | tee out.tap",
"citgm": "tap --jobs=1 --timeout=120"
"unit": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",
"unit:report": "borp --reporter=./test/test-reporter.mjs --coverage > out.test-report",

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.

This is not equivalent. It should be:

Suggested change
"unit:report": "borp --reporter=./test/test-reporter.mjs --coverage > out.test-report",
"unit:report": "c8 --reporter html borp --reporter=./test/test-reporter.mjs",

Comment thread package.json Outdated
"coverage:ci": "tap --coverage-report=html --coverage-report=lcov --allow-incomplete-coverage",
"coverage:ci-check-coverage": "tap replay",
"coverage": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage --lines 100",
"coverage:ci": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",

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.

It should be:

Suggested change
"coverage:ci": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage",
"coverage:ci": "c8 --reporter lcov --reporter html borp --reporter=./test/test-reporter.mjs",

Comment thread package.json Outdated
"coverage": "npm run unit -- --coverage-report=html",
"coverage:ci": "tap --coverage-report=html --coverage-report=lcov --allow-incomplete-coverage",
"coverage:ci-check-coverage": "tap replay",
"coverage": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage --lines 100",

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.

Suggested change
"coverage": "borp --reporter=./test/test-reporter.mjs --coverage --check-coverage --lines 100",
"coverage": "c8 --reporter html --check-coverage --100 borp --reporter=./test/test-reporter.mjs",

Comment thread borp.yaml

@jsumners jsumners left a comment

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.

🎉

@mcollina mcollina left a comment

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.

lgtm

Comment thread lib/logger.js
* Repo: https://github.com/pinojs/pino-http
* License: MIT (https://raw.githubusercontent.com/pinojs/pino-http/master/LICENSE)
*/
/* c8 ignore stop */

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.

I'm pretty sure these should not be needed

@jsumners

Copy link
Copy Markdown
Member

I'm going to merge this so work can progress. @dancastillo please determine if the c8 directives Matteo called out are actually needed and follow-up with another PR if they can be removed.

@jsumners jsumners merged commit 025fa7a into fastify:main Oct 13, 2024
@github-actions

Copy link
Copy Markdown

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 Oct 14, 2025
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