Skip to content

Conversation

@tejaskh3
Copy link
Contributor

Date: change date here

Developer Name: developer name here


Issue Ticket Number:-

  • add issue ticket number here e.g #923

Description:

Add description of the PR here

Is Under Feature Flag

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Is Development Tested?

  • Yes
  • No

Tested in staging?

  • Yes
  • No

Add relevant Screenshot below ( e.g test coverage etc. )

@coderabbitai
Copy link

coderabbitai bot commented Apr 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features
    • Introduced automated test coverage reporting for pull requests, including a new workflow that posts coverage results directly on PRs.
    • Added a script to run tests with code coverage enabled.
  • Chores
    • Integrated code coverage tools into the build and test process.
    • Updated dependencies by adding code coverage tooling and removing an unused package.

Walkthrough

The changes introduce automated code coverage reporting for an Ember application. A new GitHub Actions workflow is added to run tests and post coverage reports on pull requests. The Ember build configuration is updated to include code coverage instrumentation using a Babel plugin compatible with Embroider. The ember-cli-code-coverage package is added as a development dependency, and a script for running tests with coverage is included. The test helper is modified to ensure all modules are loaded and coverage data is sent after tests complete. An unused dependency is also removed.

Changes

File(s) Change Summary
.github/workflows/coverage.yml Added a GitHub Actions workflow to run tests and post coverage reports on pull requests.
ember-cli-build.js Updated build config to include Babel plugin for code coverage instrumentation compatible with Embroider.
package.json Added ember-cli-code-coverage to devDependencies, removed ember-cli-qrcode, and added a test:coverage script.
tests/test-helper.js Integrated code coverage reporting by loading all modules and sending coverage data after tests finish.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub
    participant GitHub Actions
    participant Node.js/Ember App
    participant lcov-reporter-action

    Developer->>GitHub: Open Pull Request
    GitHub->>GitHub Actions: Trigger coverage workflow
    GitHub Actions->>Node.js/Ember App: Checkout & setup environment
    GitHub Actions->>Node.js/Ember App: Install dependencies & run tests with coverage
    Node.js/Ember App->>Node.js/Ember App: Collect coverage data
    Node.js/Ember App->>GitHub Actions: Output lcov.info
    GitHub Actions->>lcov-reporter-action: Post coverage report as PR comment
Loading

Poem

In the warren, tests now hop with glee,
Coverage checked from branch to branch, you see!
With Babel and helpers, the code is in sight,
Reports on pull requests, coverage shining bright.
Old QR codes gone, new scripts in the sun—
This bunny’s delighted: the coverage run is done!
🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 18, 2025

Deploying www-rds with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a4b7ff
Status: ✅  Deploy successful!
Preview URL: https://d992f4c8.www-rds.pages.dev
Branch Preview URL: https://feat-add-test-coverage-bot.www-rds.pages.dev

View logs

Copy link

@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: 6

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 614891b and 9bd14e3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/coverage.yml (1 hunks)
  • ember-cli-build.js (1 hunks)
  • package.json (2 hunks)
  • tests/test-helper.js (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/coverage.yml

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


23-23: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/coverage.yml

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 5-5: too many spaces inside brackets

(brackets)


[error] 5-5: too many spaces inside brackets

(brackets)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
tests/test-helper.js (2)

8-11: Correct implementation of code coverage imports.

The imports for forceModulesToBeLoaded and sendCoverage are properly added from the test support module of ember-cli-code-coverage.


18-21: Well-implemented QUnit.done handler for coverage reporting.

The async handler correctly ensures all modules are loaded and properly awaits the coverage data transmission after tests complete. This integration follows best practices for code coverage in Ember applications.

ember-cli-build.js (1)

15-21: Correct Babel configuration for Embroider-compatible coverage.

The Babel plugin configuration correctly integrates ember-cli-code-coverage with the Embroider build system by using the embroider: true option. This ensures proper instrumentation while maintaining compatibility with the modern build pipeline.

package.json (2)

30-30: Appropriate test coverage script added.

The test:coverage script correctly sets the COVERAGE environment variable to enable code coverage during test runs.


69-69: Correct addition of ember-cli-code-coverage dependency.

Version ^3.1.0 is appropriate and uses the caret for compatible updates.

Comment on lines +35 to +38
uses: romeovs/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./coverage/lcov.info
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider adding a badge to README.

The coverage report is posted as a comment, but you might want to also add a coverage badge to your README for visibility.

After this workflow is established, you could add the following to your README.md:

[![Test Coverage](https://img.shields.io/codecov/c/github/Real-Dev-Squad/website-www/main.svg)](https://codecov.io/gh/Real-Dev-Squad/website-www)

This requires setting up integration with a service like Codecov, which could be a future enhancement.

Comment on lines +31 to +32
- name: Run tests with coverage
run: pnpm run test:coverage || true
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider failing the workflow on low coverage.

The current implementation runs tests with coverage and continues even if tests fail (|| true). While this ensures the workflow completes and reports coverage, consider adding a step to enforce a minimum coverage threshold.

You could add a step after posting the coverage comment to check the coverage percentage and fail if it's below a threshold:

- name: Check coverage threshold
  run: |
    COVERAGE=$(cat ./coverage/lcov.info | grep -oP 'LF:\K[0-9]+' | awk '{covered+=$1} END {print covered}')
    TOTAL=$(cat ./coverage/lcov.info | grep -oP 'LH:\K[0-9]+' | awk '{total+=$1} END {print total}')
    PERCENTAGE=$(awk "BEGIN { print ($TOTAL/$COVERAGE) * 100 }")
    echo "Current coverage: $PERCENTAGE%"
    if (( $(echo "$PERCENTAGE < 70" | bc -l) )); then
      echo "Coverage below threshold of 70%"
      exit 1
    fi

contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Update GitHub Actions checkout to latest version.

The runner for the checkout action is outdated.

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
📝 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
- uses: actions/checkout@v3
- uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +3 to +5
on:
pull_request:
branches: [ main, master, develop ]
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

YAML syntax issues in workflow trigger configuration.

There are spacing issues in the bracket notation of the branches array.

 on:
   pull_request:
-    branches: [ main, master, develop ]
+    branches: [main, master, develop]
📝 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
on:
pull_request:
branches: [ main, master, develop ]
on:
pull_request:
branches: [main, master, develop]
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 5-5: too many spaces inside brackets

(brackets)


[error] 5-5: too many spaces inside brackets

(brackets)

run_install: false

- name: Setup Node.js
uses: actions/setup-node@v3
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Update GitHub Actions setup-node to latest version.

The runner for the setup-node action is outdated.

-      - uses: actions/setup-node@v3
+      - uses: actions/setup-node@v4
📝 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
uses: actions/setup-node@v3
- uses: actions/setup-node@v4
🧰 Tools
🪛 actionlint (1.7.4)

23-23: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +28 to +29
- name: Install dependencies
run: pnpm install
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider caching node_modules for faster workflows.

While pnpm caching is configured, you could further optimize by caching node_modules.

      - name: Install dependencies
        run: pnpm install
+        
+      - name: Cache node_modules
+        uses: actions/cache@v4
+        with:
+          path: node_modules
+          key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
+          restore-keys: |
+            ${{ runner.os }}-node-modules-
📝 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
- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install
- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-modules-

@tejaskh3 tejaskh3 force-pushed the feat-add-test-coverage-bot branch from 9bd14e3 to 8a4b7ff Compare April 18, 2025 20:21
run: pnpm install

- name: Run tests with coverage
run: pnpm run test:coverage || true
Copy link

Choose a reason for hiding this comment

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

The || true suffix will make this step always exit with a success code, even when tests fail. This could hide test failures in the workflow. Consider either:

  1. Removing || true to ensure test failures are properly reported
  2. Using GitHub's continue-on-error: true at the step level for better error handling while still allowing the coverage reporting to proceed

This approach would maintain test integrity while still achieving the coverage reporting goal.

Suggested change
run: pnpm run test:coverage || true
run: pnpm run test:coverage
continue-on-error: true

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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.

2 participants