aspect-build / aspect-build/rules_jest

[FR]: Can we allow invoking the bazel jest_test target at the Class level rather to handling the entire module/package as a single test?

Open
#145 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Starlark
Stars
24
Forks
31
PR merge metrics
No merged PRs in 30d

Description

### What is the current behavior?

Currently, all tests within a module/folder/package are treated as a single test, and when we execute the bazel test //package_name:jest_test, all individual test files under package_name are run as a single test. As a result, whatever the timeout/size is, it applies to the whole package rather than to each test file within that module.

### Describe the feature

At the moment, if a package has, say, 5K tests, it will time out after a given length of time.
Even if we change the timeout/size to medium/large, it will eventually time out if we have a big amount of tests in the future.

Proposed solution: The bazel test rule should produce individual targets for each test file included inside it, and the timeout should be applied to those generated test file level targets.
Java is performing the same function [here](https://github.com/bazel-contrib/rules_jvm/blob/main/java/private/java_test_suite.bzl#L39)

In summary, the purpose of this FR is to execute jest_test at the test suite/class level when the rule is invoked at the package level.
When the 'bazel test //package-name:jest_test' command is executed, it should build suite level targets within and run them in a bazel manner while adhering to timeout/size criteria. This manner, no matter how many tests are in the package, there are no TIMEOUTs.

Contributor guide

Open the contributing guide

Research direction

Start by examining how the package-level bazel test //package_name:jest_test target is defined and compare its behavior with java/private/java_test_suite.bzl, which the issue references. Trace how test files are collected and how timeout and size settings are applied. Done means package invocation produces runnable per-file suite targets whose Bazel execution and timeout behavior are independently observable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.