Skip to content

Conversation

Puppo
Copy link
Contributor

@Puppo Puppo commented May 3, 2025

This PR moves hooks.test.js to the node test runner

@Puppo Puppo changed the base branch from main to next May 3, 2025 04:21
@Puppo Puppo marked this pull request as ready for review May 3, 2025 04:34
Comment on lines 7 to 14
function match (t, obj, expected) {
const checkObj = Object.keys(expected).reduce((acc, key) => {
acc[key] = obj[key]
return acc
}, {})

t.assert.deepStrictEqual(checkObj, expected)
}
Copy link
Member

Choose a reason for hiding this comment

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

It's not available in v20 yet, but I would prefer we use nodejs/node#54630. In the interim, we can copy https://github.com/newrelic/node-newrelic/blob/ebf3aa946be1e6802b567f2bfeef0b0c13613375/test/lib/custom-assertions/match.js into a file like test/assert-match.js. I'm sure it will be used in more suites than this one.

Copy link
Contributor Author

@Puppo Puppo May 6, 2025

Choose a reason for hiding this comment

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

@jsumners done. Other PRs need this match assertion. I'll wait for this one to be merged before refactoring them.

@Puppo Puppo requested a review from jsumners May 6, 2025 17:09
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

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

Aw hell. I just realized the match function is licensed Apache-2.0 and Pino is MIT. I think we can include it, but we might need to update the licenses file. @mcollina do you know?

@mcollina
Copy link
Member

mcollina commented May 7, 2025

Can we get match published as an npm module? Then it’d be less problematic.

(This code is only used in tests and not really a problem anyway).

@jsumners
Copy link
Member

jsumners commented May 7, 2025

That's a fair solution. I can do it with my account after work.

@jsumners
Copy link
Member

jsumners commented May 7, 2025

@Puppo please use https://www.npmjs.com/package/@jsumners/assert-match

npm install -D @jsumners/assert-match

@Puppo Puppo requested a review from jsumners May 8, 2025 06:19
@Puppo
Copy link
Contributor Author

Puppo commented May 8, 2025

@Puppo please use https://www.npmjs.com/package/@jsumners/assert-match

npm install -D @jsumners/assert-match

Done!

@jsumners jsumners merged commit 3941883 into pinojs:next May 8, 2025
9 checks passed
@Puppo Puppo deleted the hooks-test branch May 8, 2025 10:36
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.

3 participants