angular/aio/scripts/local_server_test.bzl
Paul Gschwendtner 90c2088679 build: make devmode a noop and ensure it never runs (#48521)
This is basically a pre-step for combining devmode and prodmode into a
single compilation. We are already achieving this now, and can claim
with confidence that we reduced possible actions by half. This is
especially important now that prodmode is used more often, but rules
potentially still using the devmode ESM sources. We can avoid double
compilations (which existed before the whole ESM migration too!).

We will measure this more when we have more concrete documentation
of the changes & a better planning document.

Changes:

  * ts_library will no longer generate devmode `d.ts`. Definitions are
    generated as part of prodmode. That way only prodmode can be exposed
    via providers.
  * applied the same to `ng_module`.
  * updates migrations to bundle because *everything* using `ts_library`
    is now ESM. This is actually also useful in the future if
    schematics rely on e.g. the compiler.
  * updates schematics for localize to also bundle. similar reason as
    above.

PR Close #48521
2022-12-19 19:50:45 +00:00

34 lines
1.2 KiB
Python

load("//tools:defaults.bzl", "nodejs_test")
def local_server_test(name, entry_point, serve_target, data = [], args = [], **kwargs):
"""Run a test script alongside a locally running http server.
Args:
name: Name of the test target
entry_point: The test script to run
serve_target: The contents to serve
data: Additional data required by the test script
args: Args to pass to the test script. Note: The special argument LOCALHOST_URL
will be substituted with the url pointing to the served contents.
**kwargs: remaining args to pass to test
"""
nodejs_test(
name = name,
testonly = True,
args = [
"$(rootpath @aio_npm//light-server/bin:light-server)",
"$(rootpath %s)" % serve_target,
"$(rootpath %s)" % entry_point,
] + args,
data = [
"//aio/scripts:run-with-local-server.mjs",
"@aio_npm//get-port",
"@aio_npm//shelljs",
"@aio_npm//tree-kill",
"@aio_npm//light-server/bin:light-server",
serve_target,
entry_point,
] + data,
entry_point = "//aio/scripts:run-with-local-server.mjs",
**kwargs
)