mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: introduce zone_compatible_jasmine_node_test rule (#48538)
Introduces a variant of `jasmine_node_test` that works with async/await in combination with ZoneJS. This is needed for tests relying on async/await in combinatin with change detection. Browser tests are already benefting from ESbuild async-await downleveling. Node tests would ideally not need this, but until ZoneJS supports native async/await we need to also process source files to avoid native async/await syntax. PR Close #48538
This commit is contained in:
@@ -418,6 +418,26 @@ def npm_package_bin(args = [], **kwargs):
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# TODO(devversion): Jasmine Node tests are only bundled using `spec_bundle`
|
||||
# because `async/await` syntax needs to be downleveled for ZoneJS. In the
|
||||
# future this can be removed when ZoneJS can work with native async/await in NodeJS.
|
||||
def zone_compatible_jasmine_node_test(name, external = [], deps = [], bootstrap = [], **kwargs):
|
||||
spec_bundle(
|
||||
name = "%s_bundle" % name,
|
||||
# Specs from this attribute are filtered and will be executed. We
|
||||
# add bootstrap here for discovery of the module mappings aspect.
|
||||
deps = deps + bootstrap,
|
||||
bootstrap = bootstrap,
|
||||
external = external + ["domino", "typescript"],
|
||||
platform = "node",
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = name,
|
||||
deps = [":%s_bundle" % name],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def jasmine_node_test(name, srcs = [], data = [], bootstrap = [], env = {}, **kwargs):
|
||||
# Very common dependencies for tests
|
||||
deps = kwargs.pop("deps", []) + [
|
||||
|
||||
Reference in New Issue
Block a user