mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Since the Bazel setup in this repo will now always use ESM, the tooling scripts/binaries in AIO need to be switched to ESM too. Most of the scripts are already ESM, but a few had to be converted. Note that the Dgeni generation does not use ESM because it's unaffected and the Dgeni CLI is used. In the future we could also update the Dgeni setup to ESM but there is no need currently. PR Close #48521
36 lines
1.3 KiB
Python
36 lines
1.3 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,
|
|
data_for_expansion = [
|
|
serve_target,
|
|
entry_point,
|
|
"@aio_npm//light-server/bin:light-server",
|
|
],
|
|
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",
|
|
] + data,
|
|
entry_point = "//aio/scripts:run-with-local-server.mjs",
|
|
**kwargs
|
|
)
|