Skip to content

feat(scripts): filter test:backend by test name#257

Merged
rlorenzo merged 2 commits into
mainfrom
feature/backend-test-name-filter
Jul 9, 2026
Merged

feat(scripts): filter test:backend by test name#257
rlorenzo merged 2 commits into
mainfrom
feature/backend-test-name-filter

Conversation

@rlorenzo

@rlorenzo rlorenzo commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • npm run test:backend -- <TestClassName> now runs just the matching tests instead of the whole suite, mirroring the frontend's test:frontend -- <file-pattern> UX.
  • Bare positional args become a --filter FullyQualifiedName~<pattern> expression (multiple patterns join with |); any arg starting with - passes through to dotnet test verbatim, so full filter expressions still work.
  • Documents both single-test commands in CLAUDE.md and tightens the file for token efficiency (merges the duplicated JS/C# O(n²) rule, compresses commit-message/design-system guidance, folds Security into C# Standards, drops stale Windows shell hints while keeping the CRLF rule).

Lint config

  • Adds no-implicit-globals: off to the existing scripts/** override in .oxlintrc.json. That rule is incompatible with the folder's plain-CommonJS top-level-function style (every script trips it); it only surfaced now because the pre-commit hook re-lints staged files and test-dotnet.js became staged.

Testing

  • npm run test:backend -- HtmlToTextConverterTests → ran exactly that class's 10 tests (~2s).
  • npm run test:backend -- --filter "FullyQualifiedName~...Convert_EmptyHtml_ReturnsEmptyString" → ran exactly 1 test, confirming verbatim passthrough.
  • npm run test:backend (no args) → unchanged, runs the full suite.
  • Pre-commit hook (lint + full test suite + build verify) passed on both commits.

rlorenzo added 2 commits July 8, 2026 08:43
- Bare args become a FullyQualifiedName filter
  (npm run test:backend -- MyTestClass)
- Args starting with "-" pass through to dotnet test verbatim
- Disable no-implicit-globals for scripts/**; it is incompatible
  with the folder's top-level-function CommonJS style
- Merge the duplicated JS/C# O(n^2) rules into one entry
- Compress the commit-message and design-system guidance
- Fold the Security section into C# Standards
- Drop stale Windows shell hints; keep the CRLF rule
@codecov-commenter

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov-commenter

codecov-commenter commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.29%. Comparing base (8991c34) to head (16277d4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #257   +/-   ##
=======================================
  Coverage   45.29%   45.29%           
=======================================
  Files         897      897           
  Lines       51929    51929           
  Branches     4879     4879           
=======================================
  Hits        23522    23522           
  Misses      27803    27803           
  Partials      604      604           
Flag Coverage Δ
backend 45.39% <ø> (ø)
frontend 43.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the developer experience of running backend tests by allowing npm run test:backend -- <pattern> to run only matching tests (via dotnet test --filter FullyQualifiedName~...), while still allowing full dotnet test argument passthrough when flags are provided. It also updates contributor docs and adjusts lint configuration to fit the scripts folder’s CommonJS style.

Changes:

  • Add CLI argument parsing to scripts/test-dotnet.js to convert bare positional args into a --filter FullyQualifiedName~... expression (OR-joined with |), and passthrough when any arg starts with -.
  • Document single-test usage for backend/frontend testing and tighten CLAUDE.md guidance.
  • Disable no-implicit-globals for scripts/** in .oxlintrc.json to avoid incompatible linting with the scripts’ style.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
scripts/test-dotnet.js Builds dotnet test args from npm CLI input to support test-name filtering and passthrough flags.
CLAUDE.md Documents single-test commands and consolidates/updates engineering guidelines.
.oxlintrc.json Updates scripts override to disable no-implicit-globals for CommonJS script patterns.

@rlorenzo
rlorenzo requested a review from bsedwards July 8, 2026 21:35
@rlorenzo
rlorenzo merged commit 1024aea into main Jul 9, 2026
14 of 15 checks passed
@rlorenzo
rlorenzo deleted the feature/backend-test-name-filter branch July 9, 2026 16:00
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.

4 participants