aspect-build / aspect-build/rules_js

[Bug]: js_test chdir fails on windows as bazel starts test in runfiles

Open
#2,333 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
378
Forks
183
Avg merge
1d 9h
Merged PRs (30d)
32

Description

### What happened?

Whilst trying to enable this test for windows: https://github.com/aspect-build/rules_js/blob/715f9abbdcde3b9e18679ab52b3c36b4c71e5856/js/private/test/data/BUILD.bazel#L112

I've noticed that the chdir fails:
```
==================== Test output for //js/private/test/data:from-genrule-data:
DEBUG: aspect_rules_js[js_test]: changing directory to user specified package js/private/test/data
D:/udu/b/j6bnscvo/execroot/_main/bazel-out/x64_windows-fastbuild/bin/js/private/test/data/from-genrule-data_/from-genrule-data: line 455: cd: js/private/test/data: No such file or directory
DEBUG: aspect_rules_js[js_test]: exit code: 1
================================================================================
```

The js_test is reaching this block; indicating that the test has been started in runfiles: https://github.com/aspect-build/rules_js/blob/715f9abbdcde3b9e18679ab52b3c36b4c71e5856/js/private/js_binary.sh.tpl#L181

Thus the code does not cd to root of output directory and the chdir later fails.

I'm happy to fix this as part of my Windows work if someone can let me know what the correct behaviour should be.

### Version

Latest rules_js
Windows

### How to reproduce

```shell

```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with js/private/test/data/BUILD.bazel and the js_test path, then read the runfiles handling around the referenced block in js/private/js_binary.sh.tpl on Windows. Reproduce the from-genrule-data failure and establish the expected working directory before determining what successful chdir behavior should be.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.