-
-
Notifications
You must be signed in to change notification settings - Fork 13
fix: make local-ci-test.sh cross platform for port 8080 kill #47
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
base: main
Are you sure you want to change the base?
fix: make local-ci-test.sh cross platform for port 8080 kill #47
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 265c8e4
Previous suggestions✅ Suggestions up to commit 9d287bd
|
|||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/local-ci-test.sh (1)
11-23: Strip or document the large blocks of commented-out setup codeThe commented “Step 2 / Step 3” sections add ~10 noisy lines that are no longer executed. Either delete them or convert to a documented function / flag so the script stays maintainable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/local-ci-test.sh(3 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
test/local-ci-test.sh
[error] 42-42: You need a space after the [ and before the ].
(SC1035)
[error] 42-42: Couldn't parse this test expression. Fix to allow more checks.
(SC1073)
[error] 42-42: Expected this to be an argument to the unary condition.
(SC1019)
[error] 42-42: You need a space before the ].
(SC1020)
[error] 42-42: Missing space before ]. Fix any mentioned problems and try again.
(SC1072)
🔇 Additional comments (1)
test/local-ci-test.sh (1)
63-66: Unit-test step may run from wrong working directoryYou
cd testearlier (Line 30) and then invokenpx vitest run. Unless the repo’s Vitest config is insidetest/, this misses the root config and will silently skip tests. Confirm the desired cwd or--rootflag.
|
@dharapandya85 Please add screenshot of tests and check the AI code review too if any necessary changes required please make it. |
Fix : Bash syntax errors Co-authored-by: codiumai-pr-agent-free[bot] <138128286+codiumai-pr-agent-free[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
test/local-ci-test.sh (2)
46-51: Windows branch still has the same spacing/flag errors previously reported
40-45:killshould not abort the script when the user lacks permissionIf the PID belongs to another user (common in shared CI runners),
killwill exit with status 1 and terminate the script because ofset -e. Add|| true(or better:kill "$PID" 2>/dev/null || true) so the build continues.- kill "$PID" + kill "$PID" || true
🧹 Nitpick comments (1)
test/local-ci-test.sh (1)
11-23: Commented-out “setup” blocks add noise—delete or guard behind a flagThese large commented sections (
# Step 2,# Step 3) bloat the script and make it harder to skim. Either remove them or introduce a--with-e2e/--with-unitCLI flag so the code is executable instead of dead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/local-ci-test.sh(3 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
test/local-ci-test.sh
[error] 48-48: You need a space after the [ and before the ].
(SC1035)
[error] 48-48: Couldn't parse this test expression. Fix to allow more checks.
(SC1073)
[error] 48-48: Expected this to be an argument to the unary condition.
(SC1019)
[error] 48-48: You need a space before the ].
(SC1020)
[error] 48-48: Missing space before ]. Fix any mentioned problems and try again.
(SC1072)
| # Run vitest unit test | ||
| echo "Running Vitest unit tests..." | ||
| npx vitest run | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure the HTTP server is killed even on early failure
set -e means any failing Vitest test will abort the script before Line 73, leaking the background server. Add a trap at the top:
SERVER_PID=
cleanup() { [[ -n "$SERVER_PID" ]] && kill "$SERVER_PID"; }
trap cleanup EXITThen you can drop the explicit kill $SERVER_PID at the end.
🤖 Prompt for AI Agents
In test/local-ci-test.sh around lines 63 to 66, the script runs Vitest tests but
uses set -e, which causes the script to exit immediately on failure, potentially
leaving the background HTTP server running. To fix this, define a cleanup
function that kills the server if its PID is set, set a trap on EXIT to call
this cleanup, and remove the explicit kill command at the script's end. This
ensures the server is always terminated even if the tests fail early.
|
Since I have fixed the errors in the terminating process script in |
|
@dharapandya85 Yeah Tests need fixes. I will Merge PR after sometime after clarifying things so that you won't miss any points. |
…aywright dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
test/local-ci-test.sh (1)
55-74: Ensure HTTP server is always torn down
set -e+ failing Vitest ⇒ script exits before Line 73, leaking the background server.Add a cleanup trap at the top:
+SERVER_PID= +cleanup() { [[ -n "$SERVER_PID" ]] && kill "$SERVER_PID"; } +trap cleanup EXITThen you can drop the explicit
kill $SERVER_PIDat the end.
♻️ Duplicate comments (1)
test/local-ci-test.sh (1)
36-54: ShellCheck-reported bugs still present – PID test & quotingThe Windows branch still has the spacing error and the
greppattern is quoted incorrectly. Add|| trueto allkill/taskkillcalls to keepset -efrom aborting.-elif command -v netstat &>/dev/null && command -v taskkill &>/dev/null; then - PID=$(netstat -ano | grep :'8080' | awk '{print $5}' | head -n 1) - if [-n "$PID "]; then - echo "Killing Windows process on port 8080 (PID: $PID)..." - taskkill /PID "$PID" /F || true +elif command -v netstat &>/dev/null && command -v taskkill &>/dev/null; then + PID=$(netstat -ano | grep ':8080' | awk '{print $5}' | head -n 1) + if [ -n "$PID" ]; then + echo "Killing Windows process on port 8080 (PID: $PID)…" + taskkill /PID "$PID" /F || true fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (39)
package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/package-lock.jsonis excluded by!**/package-lock.jsontest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry1/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry1/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry2/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry2/video.webmis excluded by!**/*.webmtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit/test-failed-1.pngis excluded by!**/*.pngtest/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit/video.webmis excluded by!**/*.webmtest/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (25)
package.json(2 hunks)test-results/.last-run.json(1 hunks)test/e2e/test-results/.last-run.json(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry1/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry2/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry1/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry2/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry1/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry2/error-context.md(1 hunks)test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry1/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry2/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry1/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry2/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry1/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry2/error-context.md(1 hunks)test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit/error-context.md(1 hunks)test/local-ci-test.sh(3 hunks)test/package.json(1 hunks)test/test-results/.last-run.json(1 hunks)test/unit/tsconfig.json(1 hunks)
✅ Files skipped from review due to trivial changes (22)
- test/test-results/.last-run.json
- test/e2e/test-results/.last-run.json
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry1/error-context.md
- test-results/.last-run.json
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry1/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry1/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry2/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium-retry2/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry1/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry1/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Firefox-retry2/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-WebKit-retry2/error-context.md
- test/package.json
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Firefox-retry2/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-Chromium-retry1/error-context.md
- test/e2e/test-results/geoInfo-fingerprint-oss-geoInfo-test-Chromium/error-context.md
- test/e2e/test-results/systemInfo-fingerprint-oss-systemInfo-Test-WebKit-retry2/error-context.md
🧰 Additional context used
🪛 Shellcheck (0.10.0)
test/local-ci-test.sh
[error] 48-48: You need a space after the [ and before the ].
(SC1035)
[error] 48-48: Couldn't parse this test expression. Fix to allow more checks.
(SC1073)
[error] 48-48: Expected this to be an argument to the unary condition.
(SC1019)
[error] 48-48: You need a space before the ].
(SC1020)
[error] 48-48: Missing space before ]. Fix any mentioned problems and try again.
(SC1072)
🔇 Additional comments (1)
package.json (1)
72-72: Major Vite upgrade – check Node engine & breaking changesJumping from Vite 4 → 7 is three major versions. Vite 5+ require Node 18+ by default. Your
"engines"field is still"node": ">=16.0.0"– this combination will install but crash at runtime.Bump the engines entry or pin Vite to a version compatible with Node 16.
|
✅ Deploy Preview for fingerprint-oss canceled.
|


User description
This PR updates the local CI shell script to support killing the port 8080 process on both Linux and macOS, as well as Git Bash (Windows).
fusersupport for Linux.lsoffor macOs .netstatandtaskkill.Run vitest unit testlocal-ci-test.shwas not running for the /test directory; local tests were possible with the directoriestest/e2eandtest/unit.test/e2e/geoInfo.test.js:e2e/systemInfo.test.js.PR Type
Bug fix, Enhancement
Description
Cross-platform port 8080 process killing support
Added macOS and Windows Git Bash compatibility
Fixed test execution order and configuration
Commented out problematic unit/e2e test setup
Diagram Walkthrough
File Walkthrough
local-ci-test.sh
Cross-platform port management and test execution fixestest/local-ci-test.sh
netstat/taskkill