aspect-build / aspect-build/rules_js
[FR]: Native node:test support in js_test
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What is the current behavior?
js_test requires an entrypoint to run, you can run NodeJS native tests (https://nodejs.org/api/test.html) by setting the entrypoint as your test file, but you can't have multiple files, or you need one js_test per test file
```python
js_test(
name = "lib_js_testrun",
size = "small",
chdir = package_name(),
data = [":lib_js_test"],
entry_point = "testfile.test.mjs",
node_options = [
"--test",
"--test-reporter",
"spec",
],
)
```
Another workaround is to use a main test file importing other files:
```
import "./first.test.mjs";
import "./second.test.mjs";
```
and putting this as the entry_point, but it doesn't scale well for bigger projects
### Describe the feature
Allowing a different flag to run node tests on the current folder would be enough for simple use cases, but maybe a separate macro `js_node_test` would make more sense to simplify attribute types would make more sense in the long term
Contributor guide
Research direction
Start by reading the existing js_test behavior around entry_point and node_options, then compare it with Node.js native test usage using --test across multiple .test.mjs files. The issue’s examples provide the entrypoint and test-file patterns to reproduce. Done means a supported js_test configuration, or a separate js_node_test macro, can discover and run multiple native test files without an importing main file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100