Not so sure if it's only autogenerated rules, but the repro I have is failing in a auto generated test rule.
Yes, this works in 1.5.0.
Auto generated rules fails to load resolve module from a relative file during a test run.
https://github.com/purkhusid/ts-jest-repro
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //:test
-----------------------------------------------------------------------------
[link_node_modules.js] manifest file /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles/jest_repro/_test.module_mappings.json
[link_node_modules.js] manifest contents {
"workspace": "jest_repro",
"bin": "bazel-out/darwin-fastbuild/bin",
"root": "npm/node_modules",
"modules": {
"jest_repro": [
"execroot",
"bazel-out/darwin-fastbuild/bin"
]
}
}
[link_node_modules.js] startCwd /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles/jest_repro
[link_node_modules.js] isExecroot false
[link_node_modules.js] resolved node_modules root npm/node_modules to /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles/npm/node_modules
[link_node_modules.js] cwd /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro
[link_node_modules.js] symlink( node_modules -> /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles/npm/node_modules )
[link_node_modules.js] mapping hierarchy [{"name":"jest_repro","link":["execroot","bazel-out/darwin-fastbuild/bin"]}]
[link_node_modules.js] symlink( jest_repro -> /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles/jest_repro/bazel-out/darwin-fastbuild/bin )
bazel node patches enabled. root: /private/var/tmp/_bazel_danielpurkhus/6514ebbf801be819708572b35f1a35af/sandbox/darwin-sandbox/5/execroot/jest_repro/bazel-out/darwin-fastbuild/bin/test.sh.runfiles symlinks in this directory will not escape
FAIL ./lib.test.js
● Test suite failed to run
Cannot find module 'jest_repro/lib' from 'lib.test.js'
at Resolver.resolveModule (../../../../../node_modules/jest-resolve/build/index.js:259:17)
at ../../../lib.test.ts:1:1
at lib.test.js:3:13
at Object. (lib.test.js:8:3)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.085s
Ran all test suites within paths "./lib.test.js".
## 🌍 Your Environment
**Operating System:**
MacOS 1.14.6
Output of bazel version:
Build label: 3.0.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Apr 6 12:55:48 2020 (1586177748)
Build timestamp: 1586177748
Build timestamp as int: 1586177748
Rules_nodejs version:
1.6.0
Must have been introduced in https://github.com/bazelbuild/rules_nodejs/compare/1.5.0...1.6.0
let's bisect...
for each commit, say ff0369c
urls for rules_nodejs"file:///Users/alx/Projects/rules_nodejs/dist/bin/release.tar.gz"note, bazel can't know that the repository rule needs to be re-run so I do a bazel clean --expunge between trials
I found the culprit causing the issue was introduced in https://github.com/bazelbuild/rules_nodejs/commit/5c2f6c10860692ca4dcfb99a27afadcb82f6f6b0
/cc @gregmagolan
Imported your repro so we see the breakage here in our CI
https://github.com/bazelbuild/rules_nodejs/pull/1850
Thanks for including the bisect steps. I couldn't figure out how to importted tar.gz in my WORKSPACE file . The file://<url> is super handy!
On my list for this week. Will get a fix into a 1.6.1 release.
Thanks for fixing it that quickly!
It looks like this regressed again in 2.0.0. I created a new issue. https://github.com/bazelbuild/rules_nodejs/issues/2008
Most helpful comment
On my list for this week. Will get a fix into a 1.6.1 release.