Repository navigation
Jest Example fails on Windows聽#1454
Description
Activity
I suspect you need to copy jest.config.js to the output folder and then reference that copy.
See https://github.com/bazelbuild/rules_nodejs/blob/master/docs/Built-ins.md#copy_to_bin
Hello
I got the same error, on windows trying to run jest tests.
So I tried to add
copy_to_binas you suggested @alexeagle but after some digging I found that jest is executed inC:\users\$USER\_bazel_$USER\u3lrkeg4\execroot\<workspace-name>\bazel-out\x64_windows-fastbuild\bin\test.bat.runfiles\<workspace-name>which is empty.The directory
C:\users\$USER\_bazel_$USER\u3lrkeg4\execroot\<workspace-name>\bazel-out\x64_windows-fastbuild\bin\seems well populated.I found in the source, there is a comment about Windows
https://github.com/bazelbuild/rules_nodejs/blob/master/examples/jest/BUILD.bazel#L14
So I tried to add this argument and ran
bazel test test --enable_runfiles. Then I get another errorINFO: Invocation ID: edecd830-ef9a-4fca-adc0-a20e5c3f1b25 INFO: Analyzed target //:test (503 packages loaded, 10582 targets configured). INFO: Found 1 test target... INFO: Deleting stale sandbox base C:/users/$USER/_bazel_$USER/olmlednd/sandbox FAIL: //:test (see C:/users/$USER/_bazel_$USER/olmlednd/execroot/examples_jest/bazel-out/x64_windows-fastbuild/testlogs/test/test.log) INFO: From Testing //:test: ==================== Test output for //:test: ERROR: Manifest file C:\Users\$USER\_bazel_$USER\olmlednd\execroot\examples_jest\bazel-out\x64_windows-fastbuild\bin\test.bat.runfiles\examples_jest\test.bat.runfiles_manifest does not exist. ================================================================================ Target //:test up-to-date: dist/bin/test.sh dist/bin/test_loader.js dist/bin/test_require_patch.js dist/bin/test.bat INFO: Elapsed time: 7.752s, Critical Path: 0.45s INFO: 2 processes: 1 remote cache hit, 1 local. INFO: Build completed, 1 test FAILED, 3 total actionsDo you have any hint, about what could go wrong ?
Reacted by Lukas Holzer@alexeagle When I go the folder
examples/jestin the rules_nodejs (stable branch) and runningbazel run :testit is working fine on macOS and Linux but on windows, it is failing with:I think I found somehow the issue:
If I run
bazel run //:testit will fail with the above errorIf I rerun
bazel run //:test --enable_runfileswith the enable_runfiles flag It will fail differently with:ERROR: Manifest file c:\Users\ADMINI~1\_BAZEL~1\rgyky3dz\execroot\EXAMPL~1\bazel-out\x64_windows-fastbuild\bin\test.bat.runfiles\examples_jest\test.bat.runfiles_manifest does not exist.And When I run now the first command without the runfiles flag it will pass
bazel run //:testAfter a
bazel cleanThe first issue withCan't find a root directory while resolving a config file path.occurs again.Addition:
When I run it with verbose logs you can see that in the failing case it uses the
module_mappings.jsonfrom a different location. This is the only difference I can see with--define=VERBOSE_LOGS=1Failing:
[link_node_modules.js] manifest file C:/users/administrator/_bazel_administrator/rgyky3dz/execroot/examples_jest/bazel-out/x64_windows-fastbuild/bin/_test.module_mappings.jsonPassing
[link_node_modules.js] manifest file c:/users/admini~1/_bazel~1/rgyky3dz/execroot/exampl~1/bazel-out/x64_windows-fastbuild/bin/test.bat.runfiles/examples_jest/_test.module_mappings.json- added a commit that references this issue
on Sep 8, 2020 - added a commit that references this issue
on Sep 17, 2020 This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs in two weeks. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!
- addedCan Close?We will close this in 30 days if there is no further activityWe will close this in 30 days if there is no further activity
on Nov 6, 2020 - added 3 commits that reference this issue
on Nov 10, 2020 This issue was automatically closed because it went two weeks without a reply since it was labeled "Can Close?"
- added 4 commits that reference this issue
on Nov 23, 2020 - added a commit that references this issue
on Nov 27, 2020 - added 2 commits that reference this issue
on Nov 27, 2020 - added 2 commits that reference this issue
on Nov 27, 2020 - added a commit that references this issue
on Jan 15, 2021


馃悶 bug report
Affected Rule
jest_test
Is this a regression?
no
Description
The jest_test rule fails on windows with the following error:
馃敩 Minimal Reproduction
https://github.com/bazelbuild/rules_nodejs/tree/master/examples/jest
running
bazel test ...馃敟 Exception or Error
see above in explanation
馃實 Your Environment
Operating System:
Windows 10
Output of
bazel version:Rules version (SHA):