Skip to content

Conversation

@shs96c
Copy link
Member

@shs96c shs96c commented Dec 19, 2025

PR Type

Enhancement, Tests


Description

  • Add Bazel support for grid-ui Jest tests

  • Integrate aspect_rules_jest dependency for test execution

  • Configure Jest test runner with Bazel build system

  • Update dependencies for Jest CLI and test utilities


Diagram Walkthrough

flowchart LR
  A["MODULE.bazel"] -->|"Add aspect_rules_jest"| B["Bazel Dependencies"]
  C["BUILD.bazel"] -->|"Load jest_test rule"| D["Jest Test Target"]
  E["jest.config.cjs"] -->|"Update transformIgnorePatterns"| F["Jest Configuration"]
  G["package.json"] -->|"Add jest-cli, jest-junit, jest-util"| H["Test Dependencies"]
  B --> D
  F --> D
  H --> D
Loading

File Walkthrough

Relevant files
Dependencies
MODULE.bazel
Add aspect_rules_jest Bazel dependency                                     

MODULE.bazel

  • Added aspect_rules_jest version 0.24.3 as a new Bazel dependency
  • Enables Jest test framework integration with Bazel build system
+1/-0     
package.json
Add Jest CLI and reporting dependencies                                   

javascript/grid-ui/package.json

  • Added jest-cli version ^29.7.0 for command-line test execution
  • Added jest-junit version ^16.0.0 for JUnit XML test reporting
  • Added jest-util version ^30.2.0 for Jest utilities
  • Supports Bazel test integration and CI/CD reporting
+3/-0     
pnpm-lock.yaml
Update dependency lock file                                                           

pnpm-lock.yaml

  • Updated lock file with new dependencies: jest-cli, jest-junit,
    jest-util
  • Added transitive dependencies for newer Jest versions (@jest/pattern,
    @jest/schemas, @jest/types versions 30.x)
  • Updated ts-jest to depend on [email protected]
  • Added [email protected] and [email protected] as new transitive dependencies
+81/-2   
Configuration changes
BUILD.bazel
Configure Jest test target in Bazel                                           

javascript/grid-ui/BUILD.bazel

  • Loaded jest_test rule from @aspect_rules_jest//jest:defs.bzl
  • Created TEST_DEPS list with testing libraries (@testing-library/react,
    @testing-library/jest-dom, ts-jest, jest-environment-jsdom)
  • Added jest_test target named "test" with Jest configuration, source
    files, and dependencies
+19/-0   
jest.config.cjs
Update Jest transformIgnorePatterns for Bazel                       

javascript/grid-ui/jest.config.cjs

  • Updated transformIgnorePatterns regex to handle Aspect Rules JS
    node_modules structure
  • Changed pattern from 'node_modules/(?!(pretty-ms|parse-ms)/)' to
    'node_modules/(?!(\\.aspect_rules_js/.*/)?(pretty-ms|parse-ms)/)'
  • Ensures proper module transformation in Bazel environment
+1/-1     

@selenium-ci selenium-ci added B-grid Everything grid and server related B-build Includes scripting, bazel and CI integrations labels Dec 19, 2025
@qodo-code-review
Copy link
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

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Add JUnit reporter

Add a reporters property to jest.config.cjs to configure jest-junit. This will
enable the generation of JUnit XML reports, making use of the newly added
dependency.

javascript/grid-ui/jest.config.cjs [30-40]

 transformIgnorePatterns: [
   'node_modules/(?!(\\.aspect_rules_js/.*/)?(pretty-ms|parse-ms)/)'
 ],
 setupFilesAfterEnv: [
   '<rootDir>/src/setupTests.tsx',
   '<rootDir>/src/tests/setup-jest.js'
 ],
+reporters: [
+  'default',
+  ['jest-junit', { outputDirectory: './reports/junit', outputName: 'js-test-results.xml' }]
+],
 testEnvironmentOptions: {
   suppressConsole: true
 }
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The PR adds the jest-junit dependency but does not configure it. This suggestion correctly proposes to add the reporter configuration in jest.config.cjs, which makes the newly added dependency functional and useful for CI environments.

Medium
Use srcs for test files

In the jest_test rule, move test source files from the data attribute to the
srcs attribute. Use glob with an exclude pattern to keep non-test source files
in data.

javascript/grid-ui/BUILD.bazel [139-146]

 jest_test(
     name = "test",
+    srcs = glob(
+        ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.spec.ts", "src/**/*.spec.tsx"],
+    ),
     config = "jest.config.cjs",
-    data = glob(["src/**/*"]) + DEPS + TEST_DEPS + [
+    data = glob(
+        ["src/**/*"],
+        exclude = ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.spec.ts", "src/**/*.spec.tsx"],
+    ) + DEPS + TEST_DEPS + [
         "tsconfig.json",
     ],
     node_modules = ":node_modules",
 )
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that test files should be in the srcs attribute for jest_test for semantic correctness and to align with Bazel best practices, which can improve dependency tracking and caching.

Low
  • More

@shs96c shs96c merged commit c23954f into SeleniumHQ:trunk Dec 22, 2025
75 of 76 checks passed
@shs96c shs96c deleted the js-grid-ui-with-bazel branch December 22, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-grid Everything grid and server related Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants