diff --git a/packages/protractor/protractor_web_test.bzl b/packages/protractor/protractor_web_test.bzl index 3f8fe44b74..bd5653988a 100644 --- a/packages/protractor/protractor_web_test.bzl +++ b/packages/protractor/protractor_web_test.bzl @@ -110,6 +110,15 @@ def _protractor_web_test_impl(ctx): ) runfiles = [configuration] + configuration_sources + on_prepare_sources + server_files = depset() + + # If a server has been specified, add it to the runfiles together with it's required runfiles. This is necessary + # as the test executable references the server executable as per `TMPL_server` and executes it. + if ctx.executable.server: + server_files = depset( + [ctx.executable.server], + transitive = [ctx.attr.server[DefaultInfo].default_runfiles.files], + ) ctx.actions.write( output = ctx.outputs.script, @@ -166,7 +175,7 @@ ${{COMMAND}} files = depset([ctx.outputs.script]), runfiles = ctx.runfiles( files = runfiles, - transitive_files = depset(transitive = [files, node_modules]), + transitive_files = depset(transitive = [files, node_modules, server_files]), # Propagate protractor_bin and its runfiles collect_data = True, collect_default = True, @@ -269,8 +278,6 @@ def protractor_web_test( # Our binary dependency must be in data[] for collect_data to pick it up # FIXME: maybe we can just ask :protractor_bin_name for its runfiles attr web_test_data = data + [":" + protractor_bin_name] - if server: - web_test_data += [server] _protractor_web_test( name = name, diff --git a/packages/protractor/test/protractor-2/BUILD.bazel b/packages/protractor/test/protractor-2/BUILD.bazel index 63c7c94646..2abfb51fa2 100644 --- a/packages/protractor/test/protractor-2/BUILD.bazel +++ b/packages/protractor/test/protractor-2/BUILD.bazel @@ -82,3 +82,13 @@ protractor_web_test_suite( ":ts_spec", ], ) + +protractor_web_test_suite( + name = "test_suite_with_configured_server", + configuration = ":conf.js", + on_prepare = ":on-prepare.js", + server = select({ + "//conditions:default": ":devserver", + }), + deps = [":ts_spec"], +)