Skip to content

test: add missing newlines to repl .exit writes #58041

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

Merged

Conversation

dario-piotrowicz
Copy link
Member

@dario-piotrowicz dario-piotrowicz commented Apr 26, 2025

I noticed that some repl tests write ".exit" in the repl, without a newline character (\n), as far as I can tell such write operations don't have any effect (removing those lines don't cause any test failures (AFAICT)).

I'm adding the missing newline characters so that the exit command is actually executed.

As part of this I'm also removing some end calls applied to the repl streams that are no longer necessary.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Apr 26, 2025
@@ -9,7 +9,8 @@ const r = initRepl();

r.input.emit('data', 'function a() { return 42; } (1)\n');
r.input.emit('data', 'a\n');
r.input.emit('data', '.exit');
r.input.emit('data', '.exit\n');
r.once('exit', common.mustCall());
Copy link
Member Author

Choose a reason for hiding this comment

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

this new mustCall assertion is unnecessary, I can remove it if people don't like this addition

Note: prior to the \n addition this would cause the test to fail

some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls
@dario-piotrowicz
Copy link
Member Author

Alternatively is preferred the various .exit writes could be removed since, as I mentioned, I don't think they serve any purpose (please do correct me if I'm wrong 😅)

But I think that keeping them in is the more correct solution 🙂

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 26, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 26, 2025
@nodejs-github-bot
Copy link
Collaborator

Copy link

codecov bot commented Apr 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.27%. Comparing base (b673c69) to head (e8e2d7a).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58041      +/-   ##
==========================================
- Coverage   90.28%   90.27%   -0.01%     
==========================================
  Files         630      630              
  Lines      186150   186328     +178     
  Branches    36468    36510      +42     
==========================================
+ Hits       168059   168205     +146     
- Misses      10975    11009      +34     
+ Partials     7116     7114       -2     

see 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot
Copy link
Collaborator

@jakecastelli jakecastelli added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Apr 28, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 28, 2025
@nodejs-github-bot nodejs-github-bot merged commit 53abd1a into nodejs:main Apr 28, 2025
64 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 53abd1a

@dario-piotrowicz dario-piotrowicz deleted the dario/test-repls-exits branch April 28, 2025 21:01
RafaelGSS pushed a commit that referenced this pull request May 1, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
RafaelGSS pushed a commit that referenced this pull request May 2, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 6, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 6, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
RafaelGSS pushed a commit that referenced this pull request May 14, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 16, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 17, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 17, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 17, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 18, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this pull request May 19, 2025
some tests write `.exit` into a repl server without
including a newline character (`\n`), such commands
are therefore simply not executed at all, the changes
here add the missing newlines and as a side effect
remove no longer necessary `end` calls

PR-URL: #58041
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants