Skip to content

fix: stabilize integration test suite#8209

Open
jherr wants to merge 2 commits intomainfrom
fix/integration-test-flakes-pr
Open

fix: stabilize integration test suite#8209
jherr wants to merge 2 commits intomainfrom
fix/integration-test-flakes-pr

Conversation

@jherr
Copy link
Copy Markdown
Contributor

@jherr jherr commented Apr 24, 2026

Summary

  • Replace hardcoded ports (4567, 9999, 3000, 6123) with dynamic getPort() calls across integration tests to prevent port collisions during concurrent execution
  • Suppress telemetry error-reporting subprocesses when process.env.CI is set (previously only checked the is-ci package)
  • Use dynamic port substitution for the next-app fixture in redirect tests
  • Fix test artifact leak in copy-template-dir unit tests by moving cleanup to afterEach with force: true
  • Add tests/unit/utils/tmp to .gitignore as a safety net

Test plan

  • Full integration test suite passes (60/60 files, 554 tests, 3 consecutive clean runs)
  • copy-template-dir unit tests pass with no leaked artifacts
  • Snapshot tests unaffected by port changes

🤖 Generated with Claude Code

@jherr jherr requested a review from a team as a code owner April 24, 2026 20:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ea48c48-d290-47bd-b914-9346e22e46ee

📥 Commits

Reviewing files that changed from the base of the PR and between 33a36d2 and 1a263ab.

📒 Files selected for processing (2)
  • tests/integration/commands/dev/redirects.test.ts
  • tests/integration/framework-detection.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/integration/framework-detection.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved error reporting to detect additional CI environments and avoid sending unnecessary telemetry.
  • Tests

    • Increased reliability by replacing hardcoded ports with dynamic port allocation across integration tests.
    • Improved test isolation with automated cleanup of temporary test output directories.
  • Chores

    • Added a gitignore rule to exclude test temporary files.

Walkthrough

Adds a gitignore rule for tests/unit/utils/tmp. Updates telemetry reportError to exit early when process.env.CI is set in addition to the existing isCI check. Refactors multiple integration tests to use dynamic port allocation via getPort() instead of hardcoded ports (dev, redirects, functions-serve, framework-detection), propagating the chosen ports into servers, configs, and test helpers. Updates one unit test suite to use a shared module-level outDir with an afterEach cleanup hook.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: stabilize integration test suite' directly reflects the main objective: replacing hardcoded ports with dynamic allocation and fixing test flakes.
Description check ✅ Passed The description comprehensively covers all changes including port stabilization, telemetry suppression, test cleanup, and gitignore updates, with a detailed test plan validating the fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/integration-test-flakes-pr

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

📊 Benchmark results

Comparing with 0415e87

  • Dependency count: 1,061 (no change)
  • Package size: 355 MB ⬆️ 0.00% increase vs. 0415e87
  • Number of ts-expect-error directives: 356 (no change)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/integration/commands/functions-serve/functions-serve.test.ts (1)

63-103: ⚠️ Potential issue | 🟡 Minor

"Default port" test no longer tests the default port — it's now a duplicate of the "custom port" test.

Both tests now pass --port <getPort()> and fetch from that same port, so coverage of the default-port code path is lost. Either:

  1. Drop this test (redundant), or
  2. Keep it testing the default behavior — spawn without --port, expect the server to listen on the documented default (9999), and skip/serialize it to avoid collisions.

Given the PR's goal is concurrency safety, option 1 is probably the right call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/functions-serve/functions-serve.test.ts` around
lines 63 - 103, The "should serve functions on default port" test is now a
duplicate of "should serve functions on custom port" because it passes --port;
remove or revert it to test default behavior: either delete the entire test
block named "should serve functions on default port" to avoid redundancy, or
change the withFunctionsServer invocation in that test to not pass args/--port
and assert the server listens on the documented default (9999) — if choosing the
latter ensure you handle test isolation (skip or serialize) to avoid port
collisions; locate the test by its title string and the use of
withFunctionsServer/getPort to make the change.
tests/integration/commands/dev/redirects.test.ts (1)

1-77: ⚠️ Potential issue | 🟡 Minor

Fix Prettier failure before merging.

GitHub Actions reports a format issue in this file. The long replace(...) call on line 52 is the likely offender — run npm run format (or prettier --write) and commit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/dev/redirects.test.ts` around lines 1 - 77,
Prettier is failing due to a long line in the setup callback where the
netlifyToml is written (the writeFile call that uses (await
readFile(netlifyTomlPath, 'utf8')).replace(...)); fix by running the project
formatter (npm run format or prettier --write
tests/integration/commands/dev/redirects.test.ts) or manually reformat that
expression (e.g., read the file into a variable, perform the replace on a
separate line, then call writeFile) so the long replace(...) call is
wrapped/split and the file passes Prettier; locate the offending code inside the
setup callback referencing netlifyTomlPath and the writeFile call to apply the
change.
🧹 Nitpick comments (1)
tests/integration/commands/completion/completion-install.test.ts (1)

26-26: Consider relaxing skipIf now that --shell zsh is explicit.

Since the test now passes --shell zsh unconditionally, the SHELL !== '/bin/zsh' gate mostly filters on the developer's login shell rather than what the CLI actually exercises. This is fine to defer, but you may get broader CI coverage by either keeping the gate only where shell-specific filesystem behavior truly matters, or documenting that the gate exists because the post-install zsh-specific paths (e.g. .zshrc edits) are what's under test.

Also applies to: 49-49

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/completion/completion-install.test.ts` at line 26,
The test currently wraps with test.skipIf(process.env.SHELL !== '/bin/zsh')
while the test already passes --shell zsh explicitly; remove or relax that
environment gate so the test runs regardless of the developer's login shell (or
narrow the gate to only the specific assertions that depend on the real login
shell). Locate the occurrences of test.skipIf(process.env.SHELL !== '/bin/zsh')
(around the completion-install test and the other occurrence at the later block)
and either delete the skipIf wrapper or replace it with a more targeted
condition or comment explaining why it's needed for zsh-specific post-install
path checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/integration/commands/dev/redirects.test.ts`:
- Line 41: The env value for NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS is currently
a number; change it to a string to match NodeJS.ProcessEnv and existing tests
(use '1' instead of 1). Locate the devServer config object (devServer: { env: {
NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: ... } }) in the test and update the
value to '1' so it matches the usage on line with
NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1' and any strict equality checks
elsewhere.
- Around line 50-53: The current test uses a fragile literal string replace on
the netlify toml contents via readFile/netlifyTomlPath and writeFile which will
silently no-op if formatting changes; update the logic in the test to perform
the replacement with a regex (matching variations like whitespace around
`targetPort` and the value) or run the replace and then assert that the result
differs from the original (using targetPort.toString() as the new value), and if
no change occurred throw/assert a failure before calling writeFile so the test
fails loudly rather than leaving netlify.toml unchanged.

In `@tests/integration/framework-detection.test.ts`:
- Line 1: Prettier formatting failed due to an over-long single-line argument in
the integration test file; run the project's formatter (npm run format) and
commit the result so the import and long-arg test lines are wrapped correctly.
Specifically, format the file that imports execa and reflow any long single-line
args in the framework-detection tests into multiple lines or use array-style
args so Prettier passes; then stage and commit the formatted file.

---

Outside diff comments:
In `@tests/integration/commands/dev/redirects.test.ts`:
- Around line 1-77: Prettier is failing due to a long line in the setup callback
where the netlifyToml is written (the writeFile call that uses (await
readFile(netlifyTomlPath, 'utf8')).replace(...)); fix by running the project
formatter (npm run format or prettier --write
tests/integration/commands/dev/redirects.test.ts) or manually reformat that
expression (e.g., read the file into a variable, perform the replace on a
separate line, then call writeFile) so the long replace(...) call is
wrapped/split and the file passes Prettier; locate the offending code inside the
setup callback referencing netlifyTomlPath and the writeFile call to apply the
change.

In `@tests/integration/commands/functions-serve/functions-serve.test.ts`:
- Around line 63-103: The "should serve functions on default port" test is now a
duplicate of "should serve functions on custom port" because it passes --port;
remove or revert it to test default behavior: either delete the entire test
block named "should serve functions on default port" to avoid redundancy, or
change the withFunctionsServer invocation in that test to not pass args/--port
and assert the server listens on the documented default (9999) — if choosing the
latter ensure you handle test isolation (skip or serialize) to avoid port
collisions; locate the test by its title string and the use of
withFunctionsServer/getPort to make the change.

---

Nitpick comments:
In `@tests/integration/commands/completion/completion-install.test.ts`:
- Line 26: The test currently wraps with test.skipIf(process.env.SHELL !==
'/bin/zsh') while the test already passes --shell zsh explicitly; remove or
relax that environment gate so the test runs regardless of the developer's login
shell (or narrow the gate to only the specific assertions that depend on the
real login shell). Locate the occurrences of test.skipIf(process.env.SHELL !==
'/bin/zsh') (around the completion-install test and the other occurrence at the
later block) and either delete the skipIf wrapper or replace it with a more
targeted condition or comment explaining why it's needed for zsh-specific
post-install path checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f84e3d98-9abe-45ad-85b4-281c3a62eb61

📥 Commits

Reviewing files that changed from the base of the PR and between 0415e87 and 59bd146.

⛔ Files ignored due to path filters (1)
  • tests/integration/commands/help/__snapshots__/help.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • .gitignore
  • src/commands/completion/completion.ts
  • src/commands/completion/index.ts
  • src/utils/telemetry/report-error.ts
  • tests/integration/commands/completion/completion-install.test.ts
  • tests/integration/commands/dev/dev.test.ts
  • tests/integration/commands/dev/redirects.test.ts
  • tests/integration/commands/functions-serve/functions-serve.test.ts
  • tests/integration/framework-detection.test.ts
  • tests/unit/utils/copy-template-dir/copy-template-dir.test.ts

await setupFixtureTests(
'next-app',
{
devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 } },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Env value should be a string for consistency and to match NodeJS.ProcessEnv typing.

Line 122 of this same file uses NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1'. Node coerces numeric values at spawn time, but TS's ProcessEnv type expects strings and downstream code typically does strict equality against '1'.

-      devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 } },
+      devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1' } },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 } },
devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1' } },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/dev/redirects.test.ts` at line 41, The env value
for NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS is currently a number; change it to a
string to match NodeJS.ProcessEnv and existing tests (use '1' instead of 1).
Locate the devServer config object (devServer: { env: {
NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: ... } }) in the test and update the
value to '1' so it matches the usage on line with
NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1' and any strict equality checks
elsewhere.

Comment on lines +50 to +53
await writeFile(
netlifyTomlPath,
(await readFile(netlifyTomlPath, 'utf8')).replace('targetPort = 6123', `targetPort = ${targetPort.toString()}`),
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fragile string replace — silently no-ops if targetPort = 6123 is ever reformatted.

String.prototype.replace with a literal needle returns the original string unchanged when no match is found, so a future reformat (e.g., targetPort=6123, different whitespace, or bumping the placeholder value) would leave netlify.toml pointing at the old port while next dev listens on the dynamic one — and the failure mode is a mysterious timeout rather than a clear error.

🛠️ Suggested fix: assert the replacement happened (or use a regex with a post-check)
-        await writeFile(
-          netlifyTomlPath,
-          (await readFile(netlifyTomlPath, 'utf8')).replace('targetPort = 6123', `targetPort = ${targetPort.toString()}`),
-        )
+        const originalToml = await readFile(netlifyTomlPath, 'utf8')
+        const updatedToml = originalToml.replace(/targetPort\s*=\s*\d+/, `targetPort = ${targetPort.toString()}`)
+        if (updatedToml === originalToml) {
+          throw new Error(`Failed to substitute targetPort in ${netlifyTomlPath}`)
+        }
+        await writeFile(netlifyTomlPath, updatedToml)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await writeFile(
netlifyTomlPath,
(await readFile(netlifyTomlPath, 'utf8')).replace('targetPort = 6123', `targetPort = ${targetPort.toString()}`),
)
const originalToml = await readFile(netlifyTomlPath, 'utf8')
const updatedToml = originalToml.replace(/targetPort\s*=\s*\d+/, `targetPort = ${targetPort.toString()}`)
if (updatedToml === originalToml) {
throw new Error(`Failed to substitute targetPort in ${netlifyTomlPath}`)
}
await writeFile(netlifyTomlPath, updatedToml)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/dev/redirects.test.ts` around lines 50 - 53, The
current test uses a fragile literal string replace on the netlify toml contents
via readFile/netlifyTomlPath and writeFile which will silently no-op if
formatting changes; update the logic in the test to perform the replacement with
a regex (matching variations like whitespace around `targetPort` and the value)
or run the replace and then assert that the result differs from the original
(using targetPort.toString() as the new value), and if no change occurred
throw/assert a failure before calling writeFile so the test fails loudly rather
than leaving netlify.toml unchanged.

Comment thread tests/integration/framework-detection.test.ts
Replace hardcoded ports with dynamic getPort() calls across integration
tests to prevent port collisions during concurrent test execution.
Suppress telemetry error-reporting subprocesses when process.env.CI is
set. Use dynamic port substitution for the next-app fixture in redirect
tests. Fix test artifact leak in copy-template-dir tests with afterEach
cleanup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jherr jherr force-pushed the fix/integration-test-flakes-pr branch from 59bd146 to 33a36d2 Compare April 24, 2026 21:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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)
tests/integration/commands/dev/redirects.test.ts (2)

41-41: ⚠️ Potential issue | 🟡 Minor

Env value should be a string to match NodeJS.ProcessEnv.

NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 should be '1' — line 122 of this same file already uses the string form, and downstream checks typically compare strictly against '1'.

-      devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 } },
+      devServer: { env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: '1' } },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/dev/redirects.test.ts` at line 41, Change the env
value for NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS from a number to a string where
it is set in the devServer config; locate the devServer object that contains
env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1 } and update the value to '1'
so it matches NodeJS.ProcessEnv and the other usage in this test file.

50-53: ⚠️ Potential issue | 🟡 Minor

Fragile literal-string replace in netlify.toml can silently no-op.

String.prototype.replace with a literal needle returns the original string when nothing matches. If the fixture's netlify.toml is ever reformatted (whitespace changes, value bump, etc.), this will silently leave the file untouched, the dev server will target 6123 while next dev listens on targetPort, and tests will fail with a confusing timeout.

🛠️ Suggested fix
-        await writeFile(
-          netlifyTomlPath,
-          (await readFile(netlifyTomlPath, 'utf8')).replace('targetPort = 6123', `targetPort = ${targetPort.toString()}`),
-        )
+        const originalToml = await readFile(netlifyTomlPath, 'utf8')
+        const updatedToml = originalToml.replace(/targetPort\s*=\s*\d+/, `targetPort = ${targetPort.toString()}`)
+        if (updatedToml === originalToml) {
+          throw new Error(`Failed to substitute targetPort in ${netlifyTomlPath}`)
+        }
+        await writeFile(netlifyTomlPath, updatedToml)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/dev/redirects.test.ts` around lines 50 - 53, The
current literal-string replace on the netlify.toml contents is fragile; instead
read the file with readFile(netlifyTomlPath, 'utf8'), perform a robust
replacement of the targetPort value using a regex that matches "targetPort" with
optional whitespace and an equals sign (e.g. /targetPort\s*=\s*\d+/) and replace
it with `targetPort = ${targetPort}` so formatting changes won't cause a no-op,
then write back with writeFile(netlifyTomlPath, updatedContents). Also assert
that the replacement actually changed the file (throw or fail the test if not)
so silent no-ops are caught.
🧹 Nitpick comments (2)
src/utils/telemetry/report-error.ts (1)

25-25: LGTM — aligns with existing CI-detection convention.

The added process.env.CI check matches the pattern already used in src/utils/scripted-commands.ts (shouldForceFlagBeInjected, isInteractive). Note that ci-info's isCI already considers process.env.CI internally, so the disjunction is effectively redundant, but keeping it consistent with the rest of the codebase is reasonable.

One optional follow-up outside this file: src/utils/telemetry/telemetry.ts track() still guards on isCI alone. If the intent of this PR is to treat process.env.CI as authoritative for suppressing telemetry side effects in CI-like environments, consider aligning track() as well so telemetry behavior is consistent across both paths.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/telemetry/report-error.ts` at line 25, The PR adds a process.env.CI
check alongside isCI in report-error.ts to suppress telemetry in CI; update the
telemetry gating to match by modifying the track() guard in the telemetry module
to also check process.env.CI (i.e., ensure track() uses "isCI ||
process.env.CI") so telemetry suppression is consistent with the new check in
report-error.ts while keeping existing isCI usage intact.
tests/integration/commands/functions-serve/functions-serve.test.ts (1)

63-82: Test title no longer reflects behavior.

"should serve functions on default port" now passes an explicit --port and is functionally identical to "should serve functions on custom port" on line 84. Consider renaming (or removing the duplicate) to avoid confusion — e.g. "should serve functions on the port provided via --port" or drop this test since it's now redundant with the next one.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/commands/functions-serve/functions-serve.test.ts` around
lines 63 - 82, The test title "should serve functions on default port" is
misleading because the test passes an explicit --port; update the test case (the
test(...) invocation in functions-serve.test.ts) to accurately reflect behavior
by renaming it to something like "should serve functions on the port provided
via --port" or remove this duplicate test entirely; locate the test block that
calls getPort() and withFunctionsServer({ builder, args: ['--port',
port.toString()], port }) and either change the first argument of test(...) to
the new, descriptive title or delete the whole test block to avoid redundancy
with the subsequent "should serve functions on custom port" test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/integration/commands/dev/redirects.test.ts`:
- Around line 38-77: Run Prettier (npm run format or prettier --write) on the
changed files to fix formatting issues flagged by CI; specifically reformat the
test file where the long one-liner occurs (in the setupFixtureTests block that
assigns packageJson.scripts.dev and the writeFile(netlifyTomlPath, (await
readFile(...)).replace(...)) call) so lines respect the repo printWidth, then
stage and commit the formatted file.

---

Duplicate comments:
In `@tests/integration/commands/dev/redirects.test.ts`:
- Line 41: Change the env value for NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS from
a number to a string where it is set in the devServer config; locate the
devServer object that contains env: { NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS: 1
} and update the value to '1' so it matches NodeJS.ProcessEnv and the other
usage in this test file.
- Around line 50-53: The current literal-string replace on the netlify.toml
contents is fragile; instead read the file with readFile(netlifyTomlPath,
'utf8'), perform a robust replacement of the targetPort value using a regex that
matches "targetPort" with optional whitespace and an equals sign (e.g.
/targetPort\s*=\s*\d+/) and replace it with `targetPort = ${targetPort}` so
formatting changes won't cause a no-op, then write back with
writeFile(netlifyTomlPath, updatedContents). Also assert that the replacement
actually changed the file (throw or fail the test if not) so silent no-ops are
caught.

---

Nitpick comments:
In `@src/utils/telemetry/report-error.ts`:
- Line 25: The PR adds a process.env.CI check alongside isCI in report-error.ts
to suppress telemetry in CI; update the telemetry gating to match by modifying
the track() guard in the telemetry module to also check process.env.CI (i.e.,
ensure track() uses "isCI || process.env.CI") so telemetry suppression is
consistent with the new check in report-error.ts while keeping existing isCI
usage intact.

In `@tests/integration/commands/functions-serve/functions-serve.test.ts`:
- Around line 63-82: The test title "should serve functions on default port" is
misleading because the test passes an explicit --port; update the test case (the
test(...) invocation in functions-serve.test.ts) to accurately reflect behavior
by renaming it to something like "should serve functions on the port provided
via --port" or remove this duplicate test entirely; locate the test block that
calls getPort() and withFunctionsServer({ builder, args: ['--port',
port.toString()], port }) and either change the first argument of test(...) to
the new, descriptive title or delete the whole test block to avoid redundancy
with the subsequent "should serve functions on custom port" test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a973665a-e06a-4027-abad-a95f092431b3

📥 Commits

Reviewing files that changed from the base of the PR and between 59bd146 and 33a36d2.

📒 Files selected for processing (7)
  • .gitignore
  • src/utils/telemetry/report-error.ts
  • tests/integration/commands/dev/dev.test.ts
  • tests/integration/commands/dev/redirects.test.ts
  • tests/integration/commands/functions-serve/functions-serve.test.ts
  • tests/integration/framework-detection.test.ts
  • tests/unit/utils/copy-template-dir/copy-template-dir.test.ts
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/integration/framework-detection.test.ts

Comment thread tests/integration/commands/dev/redirects.test.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant