aspect-build / aspect-build/rules_jest
[Bug]: No tests detected on Windows
- Dominant language
- Starlark
- Stars
- 24
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
### What happened?
I've been trying to get some simple unit tests working with `rules_jest`: it's been fine on Linux and OSX, but the rules fail on Windows: I just get
```
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in C:\Users\vagrant\_bazel_vagrant\x57pwzg3\execroot\_main\bazel-out\x64_windows-fastbuild\bin\src\src_test.bat.runfiles\_main\src
```
and variations on that theme. After struggling with my own examples, I tried to just run the example at https://github.com/aspect-build/bazel-examples/tree/main/jest
This showed the same problem.
### Version
Development (host) and target OS/architectures:
Windows 10 Pro
Output of `bazel --version`:
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
Language(s) and/or frameworks involved:
### How to reproduce
```shell
Just run `bazel run //src:src_test` on windows against https://github.com/aspect-build/bazel-examples/tree/main/jest
```
### Any other information?
I had to struggle to get it the example project to build (I needed to disable hooks for two npm dependencies), and also had some issues because the split code/test `ts_project` targets run into the known issue with the sources from one being picked up by the other (I got a lot of file permissions errors when the test compile target tried to produce the same outputs as the source compile target; however even when I changed it to have a single compilation `ts_project` the test target failed to run).
I've tried setting `patch_node_fs = False` (had some problems with test rules on windows before and this seemed to fix it) but didn't seem to help.
The run files tree looks fine - the source and test js files are all output OK as they are on other platforms. I've even added some code to my `jest.config.js` to write some output to a file with the result of calling `glob.sync('**/*.js')` and that picks the files up OK, so they are visible to node...
Contributor guide
Research direction
Reproduce the failure with `bazel run //src:src_test` from the linked jest example on Windows. Start by reading the Jest rule entry point and the example's `jest.config.js`, then trace how the runfiles path reaches Jest, including the `patch_node_fs` setting. Done means the example discovers and runs its tests on Windows without `--passWithNoTests`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system, operating-systems, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100