Skip to content

Run npm tests in CI for PRs and master pushes#925

Merged
PeterDaveHello merged 1 commit intoChatGPTBox-dev:masterfrom
PeterDaveHello:ci-run-npm-test
Feb 21, 2026
Merged

Run npm tests in CI for PRs and master pushes#925
PeterDaveHello merged 1 commit intoChatGPTBox-dev:masterfrom
PeterDaveHello:ci-run-npm-test

Conversation

@PeterDaveHello
Copy link
Copy Markdown
Member

@PeterDaveHello PeterDaveHello commented Feb 21, 2026

User description

Update the pr-tests workflow to run when test files and package manifests change, and when matching changes are pushed to master.

Run npm test before lint and build so CI validates Node unit tests automatically for both pre-merge and post-merge flows.


PR Type

Enhancement


Description

  • Add npm test execution to CI workflow before lint and build

  • Trigger workflow on test file and package manifest changes

  • Run workflow on master branch pushes with relevant changes

  • Validate Node unit tests in both pre-merge and post-merge flows


Diagram Walkthrough

flowchart LR
  PR["PR opened/reopened/synchronized"]
  PUSH["Push to master"]
  PATHS["Paths: src, tests, package files"]
  CHECKOUT["Checkout code"]
  SETUP["Setup Node 20"]
  INSTALL["npm ci"]
  TEST["npm test"]
  LINT["npm run lint"]
  BUILD["npm run build"]
  
  PR --> PATHS
  PUSH --> PATHS
  PATHS --> CHECKOUT
  CHECKOUT --> SETUP
  SETUP --> INSTALL
  INSTALL --> TEST
  TEST --> LINT
  LINT --> BUILD
Loading

File Walkthrough

Relevant files
Configuration changes
pr-tests.yml
Add npm test execution and master branch trigger                 

.github/workflows/pr-tests.yml

  • Added tests/**, package.json, package-lock.json, and workflow file to
    pull request trigger paths
  • Added new push trigger for master branch with same path filters
  • Inserted npm test step before lint and build steps in job workflow
+15/-0   

Summary by CodeRabbit

  • Chores
    • Enhanced CI/CD pipeline by adding automated test execution on pull requests and code pushes, ensuring code quality and reliability alongside existing linting and build checks.

Update the pr-tests workflow to run when test files and package
manifests change, and when matching changes are pushed to master.

Run npm test before lint and build so CI validates Node unit tests
automatically for both pre-merge and post-merge flows.
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 21, 2026

📝 Walkthrough

Walkthrough

The pull request updates the GitHub Actions workflow to automatically trigger on test-related file changes and adds an npm test execution step to the continuous integration pipeline following dependency installation.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/pr-tests.yml
Added trigger paths for test files, package manifests, and workflow itself to both pull_request and push events. Inserted new step to execute npm test after npm ci in the tests job.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A workflow grows with paths so keen,
Testing triggers, crisp and clean!
npm test hops into the chain,
Catching bugs before the main,
CI/CD dancing, lean and green! 🌿✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding npm test execution to the CI workflow for pull requests and master branch pushes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Cache npm dependencies

Add a caching step using actions/cache before npm ci to speed up dependency
installation by reusing the npm cache between workflow runs.

.github/workflows/pr-tests.yml [33-36]

 - uses: actions/setup-node@v6
   with:
     node-version: 20
+- uses: actions/cache@v3
+  with:
+    path: ~/.npm
+    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
+    restore-keys: |
+      ${{ runner.os }}-node-
 - run: npm ci

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion introduces a standard best practice by caching npm dependencies, which will significantly speed up workflow execution times and improve efficiency.

Medium
Always run CI on master push

Remove the paths filter from the push trigger to ensure the workflow runs on
every push to the master branch, regardless of which files were changed.

.github/workflows/pr-tests.yml [16-25]

 push:
   branches:
     - "master"
-  paths:
-    - "src/**"
-    - "build.mjs"
-    - "tests/**"
-    - "package.json"
-    - "package-lock.json"
-    - ".github/workflows/pr-tests.yml"
  • Apply / Chat
Suggestion importance[1-10]: 3

__

Why: This is a valid but opinionated suggestion that proposes an alternative CI strategy which contradicts the PR's explicit addition of path filters to conserve resources.

Low
Possible issue
Run tests when draft PRs are marked ready

Add the ready_for_review event to the pull_request trigger to ensure the
workflow runs when a draft PR is marked as ready.

.github/workflows/pr-tests.yml [3-25]

 on:
   pull_request:
     types:
       - "opened"
       - "reopened"
       - "synchronize"
+      - "ready_for_review"
     paths:
       - "src/**"
       - "build.mjs"
       - "tests/**"
       - "package.json"
       - "package-lock.json"
       - ".github/workflows/pr-tests.yml"
   push:
     branches:
       - "master"
     paths:
       - "src/**"
       - "build.mjs"
       - "tests/**"
       - "package.json"
       - "package-lock.json"
       - ".github/workflows/pr-tests.yml"

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a missing trigger event (ready_for_review) for draft pull requests, improving the CI workflow's reliability by covering a common development scenario.

Low
  • More

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a075e95b53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/pr-tests.yml
Copy link
Copy Markdown

Copilot AI left a comment

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 updates the pr-tests GitHub Actions workflow so CI runs Node unit tests for both pull requests and pushes to master, and triggers when test files or npm manifests change.

Changes:

  • Expand pull_request path filters to include tests/**, package.json, package-lock.json, and the workflow file itself.
  • Add a push trigger for the master branch with the same path filters.
  • Run npm test after npm ci and before lint/build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

🧹 Nitpick comments (1)
.github/workflows/pr-tests.yml (1)

37-39: Consider continue-on-error so lint/build failures are always visible.

With the current ordering, a npm test failure will short-circuit the job and skip npm run lint and npm run build. If the goal is to surface all failure types in a single run, add continue-on-error: true to the test step (or set if: always() on subsequent steps).

⚙️ Option A – allow lint/build to always report
-      - run: npm test
+      - run: npm test
+        continue-on-error: true
       - run: npm run lint
       - run: npm run build
⚙️ Option B – unconditionally run lint and build regardless of prior step outcome
       - run: npm test
-      - run: npm run lint
-      - run: npm run build
+      - run: npm run lint
+        if: always()
+      - run: npm run build
+        if: always()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-tests.yml around lines 37 - 39, The workflow currently
stops after a failing "npm test" step so "npm run lint" and "npm run build" may
be skipped; update the job steps so failures are all reported by either adding
continue-on-error: true to the "npm test" step or by adding if: always() to the
"npm run lint" and "npm run build" steps so those commands always run and
surface lint/build failures (refer to the steps that run "npm test", "npm run
lint", and "npm run build").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/pr-tests.yml:
- Around line 37-39: The workflow currently stops after a failing "npm test"
step so "npm run lint" and "npm run build" may be skipped; update the job steps
so failures are all reported by either adding continue-on-error: true to the
"npm test" step or by adding if: always() to the "npm run lint" and "npm run
build" steps so those commands always run and surface lint/build failures (refer
to the steps that run "npm test", "npm run lint", and "npm run build").

@PeterDaveHello PeterDaveHello merged commit a410842 into ChatGPTBox-dev:master Feb 21, 2026
6 checks passed
@PeterDaveHello PeterDaveHello deleted the ci-run-npm-test branch February 21, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants