Skip to content

Conversation

@samithkavishke
Copy link
Contributor

Purpose

Fixes: wso2/product-ballerina-integrator#1942

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email [email protected] to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

UI Component Development

Specify the reason if following are not followed.

  • Added reusable UI components to the ui-toolkit. Follow the intructions when adding the componenent.
  • Use ui-toolkit components wherever possible. Run npm run storybook from the root directory to view current components.
  • Matches with the native VSCode look and feel.

Manage Icons

Specify the reason if following are not followed.

  • Added Icons to the font-wso2-vscode. Follow the instructions.

User stories

image

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to [email protected] and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

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

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@samithkavishke samithkavishke changed the base branch from main to bi-1.5.x November 18, 2025 16:23
@kanushka kanushka requested review from Copilot and removed request for gigara and hevayo November 19, 2025 02:14
Copilot finished reviewing on behalf of kanushka November 19, 2025 02:16
Copy link
Contributor

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 adds support for displaying and running test cases in workspace projects (workspaces containing multiple Ballerina projects). The implementation differentiates between single-project and multi-project workspace scenarios.

Key changes:

  • Test discovery now handles workspace projects with multiple child projects
  • Test hierarchy includes project-level grouping for workspace contexts
  • Test execution commands are constructed differently for workspace vs single project scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.

File Description
runner.ts Adds logic to extract project paths from test items, determine workspace context, construct appropriate test commands for workspace/single projects, and locate test results in the correct directory
discover.ts Implements workspace-aware test discovery, creates project-level test groups for workspaces, and handles file changes/deletions across multiple projects

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

if (isTestFunctionItem(test)) {
// Extract from test ID: test:${projectPath}:${fileName}:${functionName}
const parts = test.id.split(':');
if (parts.length >= 2) {
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The test ID parsing assumes a specific format but doesn't validate that parts[0] is 'test'. If the ID format changes or is malformed, this could return incorrect data. Consider adding validation: if (parts[0] === 'test' && parts.length >= 2) to ensure the ID follows the expected format.

Suggested change
if (parts.length >= 2) {
if (parts.length >= 2 && parts[0] === 'test') {

Copilot uses AI. Check for mistakes.
const workingDirectory = projectName ? StateMachine.context().workspacePath || projectPath : projectPath;
runCommand(command, workingDirectory).then(() => {
const endTime = Date.now();
const timeElapsed = testItems.length > 0 ? (endTime - startTime) / testItems.length : (endTime - startTime);
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The time elapsed calculation logic is duplicated multiple times throughout the file. Extract this into a helper function like calculateTimeElapsed(startTime: number, endTime: number, testItems: TestItem[]): number to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
const EndTime = Date.now();
const timeElapsed = (EndTime - startTime) / testItems.length;
const endTime = Date.now();
const timeElapsed = (endTime - startTime) / testItems.length;
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The time elapsed calculation logic is duplicated multiple times throughout the file. Extract this into a helper function like calculateTimeElapsed(startTime: number, endTime: number, testItems: TestItem[]): number to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
const workingDirectory = projectName ? StateMachine.context().workspacePath || projectPath : projectPath;
runCommand(command, workingDirectory).then(() => {
const endTime = Date.now();
const timeElapsed = (endTime - startTime) / testItems.length;
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The time elapsed calculation logic is duplicated multiple times throughout the file. Extract this into a helper function like calculateTimeElapsed(startTime: number, endTime: number, testItems: TestItem[]): number to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
const EndTime = Date.now();
const timeElapsed = (EndTime - startTime) / testItems.length;
const endTime = Date.now();
const timeElapsed = (endTime - startTime) / testItems.length;
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The time elapsed calculation logic is duplicated multiple times throughout the file. Extract this into a helper function like calculateTimeElapsed(startTime: number, endTime: number, testItems: TestItem[]): number to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
function getProjectPathFromTestItem(test: TestItem): string | undefined {
if (isTestFunctionItem(test)) {
// Extract from test ID: test:${projectPath}:${fileName}:${functionName}
const parts = test.id.split(':');
Copy link
Contributor

Choose a reason for hiding this comment

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

if projectPath is absolute path, this logic will break on Windows.

on Windows project path contains : (colons) (e.g., C:\Users\...\project), which breaks the parsing logic in getProjectPathFromTestItem() and belongsToFile().

Change the separator to something that won't conflict with file paths, such as | (pipe): test|${projectPath}|${fileName}|${functionName}.

@kanushka kanushka merged commit 2f26e4e into wso2:bi-1.5.x Nov 19, 2025
6 checks passed
@kanushka
Copy link
Contributor

Merging this PR due to priority. @samithkavishke Let’s handle this issue as a separate issue.
#957 (comment)

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.

Extend the test explorer to support Ballerina workspaces

2 participants