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

Fix require warning with tests from stdin #3774

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Jun 6, 2024

What?

Why?

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

@mstoykov mstoykov added this to the v0.52.0 milestone Jun 6, 2024
@mstoykov mstoykov requested a review from a team as a code owner June 6, 2024 08:56
@mstoykov mstoykov requested review from oleiade and joanlopez and removed request for a team June 6, 2024 08:56
@mstoykov
Copy link
Contributor Author

mstoykov commented Jun 6, 2024

This specifically fixes #3534 (comment) and related problems

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.84%. Comparing base (44d7840) to head (e121e12).

Current head e121e12 differs from pull request most recent head ca166df

Please upload reports for the commit ca166df to get more accurate results.

Files Patch % Lines
js/modules/require_impl.go 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3774      +/-   ##
==========================================
- Coverage   71.86%   71.84%   -0.03%     
==========================================
  Files         291      291              
  Lines       21249    21255       +6     
==========================================
  Hits        15270    15270              
- Misses       4917     4921       +4     
- Partials     1062     1064       +2     
Flag Coverage Δ
ubuntu 71.78% <86.66%> (-0.02%) ⬇️
windows 71.71% <86.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstoykov mstoykov force-pushed the fixRequireWarningWithStdin branch from d61ba18 to fe7fd71 Compare June 7, 2024 07:46
switch opt := o.(type) {
case fsext.Fs:
fs = opt
case lib.RuntimeOptions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit; out of curiosity - if we normally use *lib.RuntimeOptions, is there any reason why not using it here instead of the value? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean instead of using opts?

We can - but this is a copy of the helper function just above here that does a very similar thing, but doesn't go through stdin.

I kind of prefered to not rewrite the whole funciton, and me trying to add it to the above was pretty painful and ended up being way bigger change.

So in the interest of not having to have a huge change (across everything using the above helper) - I decided to copy it and leave everything but what I need as it is.
If we add more tests for executing from stdin - this will likely need most of the other options and stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, no, I was asking value vs ref.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh. Looking at it we basically have a pointer ... for no reason. It is used to check if it was set - but then we just set it to the empty ones, so IMO we probably can move to a not pointer variant.

@mstoykov mstoykov merged commit c9e7018 into master Jun 13, 2024
23 checks passed
@mstoykov mstoykov deleted the fixRequireWarningWithStdin branch June 13, 2024 12:32
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.

4 participants