nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

test: Increase coverage

Open AugustinMauroy opened this issue 2 years ago • 17 comments

Description

Goal, increase test coverage.

Area concerned:

  • util/
  • hooks/
  • 🆗 next-data/ some have been tested, but not all
  • providers/

Validation

All test should pass.

Related Issues

No related issue.

Check List

  • [X] I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • [x] I have run npx turbo lint to ensure the code follows the style guide. And run npx turbo lint:fix to fix the style errors if necessary.
  • [x] I have run npx turbo format to ensure the code follows the style guide.
  • [X] I have run npx turbo test to check if all tests are passing.
  • [X] I've covered new added functionality with unit tests if necessary.

AugustinMauroy avatar Feb 17 '24 13:02 AugustinMauroy

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2024 11:24am

vercel[bot] avatar Feb 17 '24 13:02 vercel[bot]

Any updates here?

ovflowd avatar Feb 24 '24 15:02 ovflowd

stuck with next-data which is giving me a hard time

AugustinMauroy avatar Feb 24 '24 17:02 AugustinMauroy

stuck with next-data which is giving me a hard time

Can you share your difficulties?

ovflowd avatar Feb 24 '24 22:02 ovflowd

Can you share your difficulties?

It's junior's problem. But I don't know what to test. And I don't know where the line is between mocking data and using the real thing. Another point is that it's a part of the infra that I despise less, so I have to test and understand the elements to be able to test them. Also, why are the generators in mjs and not in typescript?

AugustinMauroy avatar Feb 25 '24 22:02 AugustinMauroy

Can you share your difficulties?

It's junior's problem. But I don't know what to test. And I don't know where the line is between mocking data and using the real thing. Another point is that it's a part of the infra that I despise less, so I have to test and understand the elements to be able to test them. Also, why are the generators in mjs and not in typescript?

There was a reasoning behind, and mostly because they are also imported on other non-ts files. So they cannot be TS ;)

You can ignore the the next-data tests for now, there's no much to test there, besides that the data structures match snapshots or desired outcomes.

For the time being, just update the remaining utils, scripts and anything else that can be unit tested :)

ovflowd avatar Mar 01 '24 18:03 ovflowd

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 97 🟢 96 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 96 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 95 🟢 100 🟢 92 🔗
/en/download 🟢 100 🟢 95 🟢 100 🟢 91 🔗
/en/blog 🟢 97 🟢 96 🟢 100 🟢 92 🔗

github-actions[bot] avatar Mar 01 '24 20:03 github-actions[bot]

I fix conflict. And all is good normally (if you don't test next-data).

AugustinMauroy avatar Mar 01 '24 20:03 AugustinMauroy

someone can run the tests on his machine, because on mine it works. Yes, it sounds like a joke, but it's really strange. And yes, I did push my last commit.

AugustinMauroy avatar Mar 02 '24 08:03 AugustinMauroy

someone can run the tests on his machine, because on mine it works. Yes, it sounds like a joke, but it's really strange. And yes, I did push my last commit.

What works on your machine but not here?

ovflowd avatar Mar 19 '24 15:03 ovflowd

What works on your machine but not here?

On the CI jest to tests that fail. But on my Mac I have all the tests that pass.

AugustinMauroy avatar Mar 19 '24 19:03 AugustinMauroy

Capture d’écran 2024-03-20 à 16 26 35

AugustinMauroy avatar Mar 20 '24 15:03 AugustinMauroy

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 91%
89.68% (574/640) 75.1% (175/233) 91.4% (117/128)

Unit Test Report

Tests Skipped Failures Errors Time
120 0 :zzz: 0 :x: 0 :fire: 5.506s :stopwatch:

github-actions[bot] avatar Mar 22 '24 10:03 github-actions[bot]

Holy moly macaroni, Ci is green again (can't wait to leave jest) @nodejs/nodejs-website you can review now

AugustinMauroy avatar Mar 22 '24 10:03 AugustinMauroy

@AugustinMauroy I guess I messed up on the rebase, can you fix it?

ovflowd avatar Mar 28 '24 23:03 ovflowd

@AugustinMauroy I guess I messed up on the rebase, can you fix it?

always a pleasure to fight with Jest

AugustinMauroy avatar Mar 29 '24 07:03 AugustinMauroy

@AugustinMauroy I guess I messed up on the rebase, can you fix it?

always a pleasure to fight with Jest

It's more like the file was renamed and.. well, I choose the wrong name on the rebase 🤡

ovflowd avatar Mar 29 '24 10:03 ovflowd

(You can address that on a follow-up PR)

ovflowd avatar Apr 01 '24 13:04 ovflowd