Skip to content

test(core): add unit tests for shellQuote utility - #4161

Merged
cv merged 4 commits into
NVIDIA:mainfrom
atulya-singh:test/shell-quote
Jun 4, 2026
Merged

cv merged 4 commits into
NVIDIA:mainfrom
atulya-singh:test/shell-quote

Conversation

@atulya-singh

@atulya-singh atulya-singh commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for the shellQuote utility in src/lib/core/shell-quote.ts. The function had no test coverage despite being used to safely interpolate values into bash -c strings.

Changes

  • Add src/lib/core/shell-quote.test.ts covering: simple strings, plain word wrapping, embedded single-quote escaping, empty string, special shell characters ($), and strings consisting entirely of single quotes.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Atulya Singh [email protected]

Summary by CodeRabbit

  • Tests
    • Added comprehensive test coverage for shell quote functionality, including validation of quoting behavior for various input types such as plain words, special characters, and edge cases.

Review Change Stack

@copy-pr-bot

copy-pr-bot Bot commented May 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 47e9abb1-a813-47f7-aa47-5ca2d10816d6

📥 Commits

Reviewing files that changed from the base of the PR and between 85e2133 and 021c937.

📒 Files selected for processing (1)
  • src/lib/core/shell-quote.test.ts

📝 Walkthrough

Walkthrough

This PR adds a Vitest test suite for the shellQuote function. The suite validates quoting and escaping behavior across simple words, empty strings, strings with special characters like $, embedded single quotes, and strings consisting only of single quotes.

Changes

shellQuote Test Suite

Layer / File(s) Summary
shellQuote Test Cases
src/lib/core/shell-quote.test.ts
Vitest suite with test cases asserting expected output from shellQuote for simple words, empty input, special character handling, single-quote escaping, and quote-only strings.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

A rabbit hops through tests so bright,
Each quote and escape checked just right,
From $ to ', no stone left bare,
The shellQuote dances with utmost care! 🐰✨

🚥 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 unit tests for the shellQuote utility, which is the sole focus of this PR.
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 unit tests (beta)
  • Create PR with unit tests

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.


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

@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this detailed PR about adding unit tests for the shellQuote utility. This proposes a way to improve test coverage for the shellQuote function in the core library by adding unit tests for various scenarios.

@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance feature PR adds or expands user-visible functionality and removed CI/CD labels Jun 3, 2026
@cv cv added the v0.0.59 label Jun 4, 2026
@cv
cv merged commit 5749c92 into NVIDIA:main Jun 4, 2026
17 checks passed
@wscurran wscurran removed the feature PR adds or expands user-visible functionality label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants