bazelbuild / rules_closure

Closure rules for Bazel
https://developers.google.com/closure
Apache License 2.0
153 stars 114 forks source link

Missing source maps for closure_js_test #356

Open michaelfig opened 5 years ago

michaelfig commented 5 years ago

Hi. First off, I'm not sure if this is related to #16 or #193, so I'm opening a new issue.

I'm finding that for the closure_js_test rule in https://github.com/michaelfig/tink/blob/jstest/javascript/BUILD.bazel#L214

when I run the following from the toplevel tink directory, it fails with:

Michael-Macbook-655:tink michael$ bazel test javascript:test_lib_registry
INFO: Analysed target //javascript:test_lib_registry (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
FAIL: //javascript:test_lib_registry (see /private/var/tmp/_bazel_michael/6de72905b448fffc7be7652a860
e4346/execroot/tink/bazel-out/darwin-fastbuild/testlogs/javascript/test_lib_registry/test.log)
Target //javascript:test_lib_registry up-to-date:
  bazel-bin/javascript/test_lib_registry
INFO: Elapsed time: 5.330s, Critical Path: 5.13s
INFO: 2 processes: 1 darwin-sandbox, 1 local.
INFO: Build completed, 1 test FAILED, 2 total actions
//javascript:test_lib_registry                                           FAILED in 5.1s
  /private/var/tmp/_bazel_michael/6de72905b448fffc7be7652a860e4346/execroot/tink/bazel-out/darwin-fastbuild/testlogs/javascript/test_lib_registry/test.log

INFO: Build completed, 1 test FAILED, 2 total actions

Okay, no problem, I have a failed test.

What makes things difficult is the lack of source maps, so I get stack traces with something like:

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //javascript:test_lib_registry
-----------------------------------------------------------------------------
Listening http://localhost:57849/index.html
Serving /index.html
Serving /filez/io_bazel_rules_closure/closure/testing/phantomjs_jsunit_runner.js
Serving /filez/tink/javascript/test_lib_registry_bin.js
[...]
01:36:56.134 : Running test: testRegisterPrimitiveWrapper_overwritingWithDifferentClass
-> $module$exports$tink$Registry$registerPrimitiveWrapper$$@http://localhost:53490/filez/tink/javascript/test_lib_registry_bin.js:3084:49
-> testRegisterPrimitiveWrapper_overwritingWithDifferentClass@http://localhost:53490/filez/tink/javascript/test_lib_registry_bin.js:5813:59
[native code]
$$JSCompiler_prototypeAlias$$$$invokeFunction_$$@http://localhost:53490/filez/tink/javascript/test_lib_registry_bin.js:5219:50
$$JSCompiler_prototypeAlias$$$$safeRunTest_$$@http://localhost:53490/filez/tink/javascript/test_lib_registry_bin.js:5206:32
$$JSCompiler_prototypeAlias$$$$safeRunTest_$$@[native code]
$goog$testing$Continuation_$run$$@http://localhost:53490/filez/tink/javascript/test_lib_registry_bin.js:5501:96

etc.

I would have thought that rules_closure would make source maps Just Work, so I'm looking for advice on how to enable them, or what we can fix in rules_closure to make this work.

michaelfig commented 5 years ago

Indeed, /private/var/tmp/_bazel_michael/6de72905b448fffc7be7652a860e4346/execroot/tink/bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin.js.map exists and looks to have the right contents, it's just not appearing in the test output.

Excerpts from the build params may be informative:

Michael-Macbook-655:tink michael$ grep -B1 javascript/.*test_lib_registry bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin.js-0.params 
--js_output_file
bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin.js
--
--create_source_map
bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin.js.map
--
--output_errors
bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin-stderr.txt
--
--info
bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_lib.pbtxt
--
--source_map_location_mapping
bazel-out/darwin-fastbuild/bin/javascript/test_lib_registry_bin.js|test_lib_registry_bin.js
Michael-Macbook-655:tink michael$