Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(docs): fix test timeout #2782

Merged
merged 9 commits into from
Apr 20, 2024
Merged

test(docs): fix test timeout #2782

merged 9 commits into from
Apr 20, 2024

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Apr 1, 2024

This is an attempt to fix the frequent test timeouts in verify-jsdoc-tags.

I was unable to identify the root cause of this beyond:

pnpm run test run test/scripts/apidocs/verify-jsdoc-tags.spec.ts

✓ test/scripts/apidocs/verify-jsdoc-tags.spec.ts (2410 tests) 34405ms

Test Files 1 passed (1)
Tests 2410 passed (2410)
Type Errors no errors
Start at 20:46:37
Duration 41.12s (transform 22.75s, setup 92ms, collect 5.58s, tests 34.41s, environment 0ms, prepare 391ms)

Some strange things I noticed:

  • AFAICT Only happens on mac and windows (AFAICT)
    • I can reproduce it quite consistently on my system now, but I'm unable to debug it (or at least I don't know how)
  • It only happens on the first run of pnpm run test, re-running the tests (without restarting node) doesn't repeat the error
  • It always fails a random test, I was unable to identify which one exactly (first, last or any in between)
  • It appears to be related to import(path) but not sure
  • The duration of the "delay" seems to be very consistent (hence the 30s timeout)

@ST-DDT ST-DDT added p: 1-normal Nothing urgent c: test labels Apr 1, 2024
@ST-DDT ST-DDT added this to the vAnytime milestone Apr 1, 2024
@ST-DDT ST-DDT self-assigned this Apr 1, 2024
@ST-DDT ST-DDT requested a review from a team as a code owner April 1, 2024 23:00
Copy link

netlify bot commented Apr 1, 2024

Deploy Preview for fakerjs canceled.

Name Link
🔨 Latest commit 415f321
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/66238a054e415d000890d50a

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.96%. Comparing base (016a5b6) to head (415f321).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2782      +/-   ##
==========================================
- Coverage   99.96%   99.96%   -0.01%     
==========================================
  Files        2973     2973              
  Lines      212613   212613              
  Branches      601      950     +349     
==========================================
- Hits       212540   212529      -11     
- Misses         73       84      +11     

see 1 file with indirect coverage changes

@ST-DDT ST-DDT changed the title fix: test timeout test(date): fix test timeout Apr 1, 2024
@ST-DDT ST-DDT changed the title test(date): fix test timeout fix(date): fix test timeout Apr 1, 2024
@ST-DDT ST-DDT requested a review from a team April 5, 2024 15:31
@ST-DDT ST-DDT changed the title fix(date): fix test timeout test(docs): fix test timeout Apr 5, 2024
@xDivisionByZerox
Copy link
Member

Not sure if pumping up the timeout isn't only kicking the porplem down the road.

@Shinigami92
Copy link
Member

Not sure if pumping up the timeout isn't only kicking the porplem down the road.

This is exactly the reason why I didn't approved this PR yet

@xDivisionByZerox
Copy link
Member

I simply wanted to leave the comment to explain why I feel unsure about approving this (same as @Shinigami92 stated). That being said, I currently don't feel motivated to inspect this issue myself.

@ST-DDT
Copy link
Member Author

ST-DDT commented Apr 6, 2024

Well, not doing anything to prevent the errors is also just "kicking the problem down the road" with extra work
(because the tests fail in CI and locally).
We could create an investigation issue to raise/retain awareness of this test quirk.

@ST-DDT ST-DDT added the s: needs decision Needs team/maintainer decision label Apr 6, 2024
@Shinigami92
Copy link
Member

Shinigami92 commented Apr 8, 2024

Collecting some of the failing CIs

Right now it is 100% inside test/scripts/apidocs/verify-jsdoc-tags.spec.ts 🤔

@Shinigami92
Copy link
Member

@Shinigami92
Copy link
Member

It looks like the problem always and only appears in verify-jsdoc-tags.spec.ts > verify JSDoc tags
However it appears in verify @deprecated tag and verify @example tag

I suggest to investigate why it is failing there, are there specific load-times? Can we e.g. cache something for a run? Or specifically the other way: do we need to warmup something?

@ST-DDT
Copy link
Member Author

ST-DDT commented Apr 17, 2024

I suggest to investigate why it is failing there, are there specific load-times? Can we e.g. cache something for a run? Or specifically the other way: do we need to warmup something?

The first dynamic import takes very long. For some strange reason it only happens with the module files, maybe because the are generated on the fly? So we have the option to either increase the hook timeout to 30s or the test timeout to 30s.
If we initialize it in the hook, then we get the console logs an additional time, so IMO it is best to just increase the test timeout.

@Shinigami92 Shinigami92 removed the s: needs decision Needs team/maintainer decision label Apr 17, 2024
@ST-DDT ST-DDT requested a review from a team April 17, 2024 20:16
@ST-DDT ST-DDT merged commit b27d4fc into next Apr 20, 2024
20 checks passed
@ST-DDT ST-DDT deleted the fix/test/timeout branch April 20, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants