Skip to content

🧪 Add test coverage for cross-brand constants logic#36

Merged
sunnylqm merged 4 commits into
masterfrom
test-constants-module-17454415258068094899
May 18, 2026
Merged

🧪 Add test coverage for cross-brand constants logic#36
sunnylqm merged 4 commits into
masterfrom
test-constants-module-17454415258068094899

Conversation

@sunnylqm
Copy link
Copy Markdown
Collaborator

@sunnylqm sunnylqm commented May 17, 2026

🎯 What:
Added a test suite (tests/constants.test.ts) to verify the module-level evaluation of constants within src/utils/constants.ts. The script evaluates values depending on process.argv dynamically.

📊 Coverage:

  • Tests IS_CRESC, scriptName, credentialFile, updateJson, tempDir, pricingPageUrl, and defaultEndpoints mapping when process.argv mimics a "cresc" run.
  • Tests the exact same mappings when process.argv mimics a "pushy" run.
  • Validates the isPPKBundleFileName utility logic.

Result:
The constants logic is now deterministically tested and guarded against accidental modifications that would break cross-brand behaviors. Module cache busting via dynamic imports guarantees clean independent tests.


PR created automatically by Jules for task 17454415258068094899 started by @sunnylqm

Summary by CodeRabbit

  • Tests

    • Added a new test suite validating script-specific constant exports and verifying bundle filename classification logic across multiple scenarios.
  • Chores

    • Updated build and prepublish scripts to invoke the typecheck/build pipeline via npm run instead of bun run.

Review Change Stack

Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 839ea312-a7df-49ba-a8a1-d611c726bf30

📥 Commits

Reviewing files that changed from the base of the PR and between d0524f6 and 988a748.

📒 Files selected for processing (2)
  • package.json
  • tests/constants.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/constants.test.ts

📝 Walkthrough

Walkthrough

New Bun test suite for src/utils/constants.ts and minor package.json script changes: tests simulate different script argv values via dynamic import to verify constants for cresc and pushy, and validate isPPKBundleFileName; package scripts now invoke typecheck/build via npm instead of bun.

Changes

Constants Module Test Coverage

Layer / File(s) Summary
Package.json build & prepublish scripts
package.json
build now runs npm run typecheck:build instead of bun run typecheck:build; prepublishOnly runs npm run build instead of bun run build.
Test helper for dynamic module loading
tests/constants.test.ts
Helper overrides process.argv, dynamically imports src/utils/constants.ts with a cache-busting query string, and restores process.argv.
Script-context constant assertions
tests/constants.test.ts
Tests assert exported constants (scriptName, IS_CRESC, credential/update/temp filenames, pricing URL, default endpoints) when module loads under cresc and pushy script paths.
Bundle filename classifier tests
tests/constants.test.ts
Unit tests confirm isPPKBundleFileName accepts index.bundlejs and bundle.harmony.js, and rejects index.js and main.bundlejs.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A suite of tests so fine,
Constants dancing in a line,
Script paths cresc and pushy play,
Bundle names we classify today,
Hooray — the tiny checks all sway!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding test coverage for constants logic with cross-brand scenarios (cresc and pushy).
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 test-constants-module-17454415258068094899

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/constants.test.ts`:
- Around line 13-33: Run the Biome formatter to fix the formatting issues in the
test file so CI passes: run the provided formatter command (biome format --write
tests/constants.test.ts) or reformat the two defaultEndpoints array literals in
the tests (in the "should initialize correctly when script is cresc" and "should
initialize correctly when script is pushy" test blocks) to the multiline style
Biome expects; then commit the formatted changes so the arrays and surrounding
whitespace match the project's Biome formatting rules.
- Around line 3-10: The helper loadConstantsWithArgv mutates process.argv but
doesn’t guarantee restoration if the dynamic import throws; wrap the import and
return in a try block and move the process.argv = originalArgv into a finally
block so originalArgv is always restored, referencing loadConstantsWithArgv,
originalArgv, process.argv and the dynamic import url to locate where to add the
try/finally.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e03e16f-02e9-45f8-ba46-dab2fff700b9

📥 Commits

Reviewing files that changed from the base of the PR and between 2be3698 and d0524f6.

📒 Files selected for processing (1)
  • tests/constants.test.ts

Comment thread tests/constants.test.ts
Comment thread tests/constants.test.ts
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 1 unresolved review comment.

Files modified:

  • package.json
  • tests/constants.test.ts

Commit: 988a7487d9f5e33d65b007c03310c80bd043f245

The changes have been pushed to the test-constants-module-17454415258068094899 branch.

Time taken: 2m 50s

coderabbitai Bot and others added 2 commits May 18, 2026 08:01
Fixed 2 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@sunnylqm sunnylqm merged commit b82efd1 into master May 18, 2026
4 checks passed
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