Files
angular__angular/tools/size-tracking/index.bzl
T
Paul Gschwendtner 95555658cf build: disable bazel nodejs linker to improve stability on windows (#45872)
The NodeJS Bazel linker does not work well on Windows because there
is no sandboxing and linker processes from different tests will attempt
to modify the same `node_modules`, causing concurrency race conditions
and resulting in flakiness.

PR Close #45872
2022-05-04 16:20:57 -07:00

53 lines
1.3 KiB
Python

# Copyright Google LLC All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.io/license
load("//tools:defaults.bzl", "nodejs_binary", "nodejs_test")
"""
Macro that can be used to track the size of a given input file by inspecting
the corresponding source map. A golden file is used to compare the current
file size data against previously approved file size data
"""
def js_size_tracking_test(
name,
src,
source_map,
golden_file,
max_percentage_diff,
max_byte_diff,
data = [],
**kwargs):
all_data = data + [
"//tools/size-tracking",
"@npm//source-map",
"@npm//chalk",
]
entry_point = "//tools/size-tracking:index.ts"
nodejs_test(
name = name,
data = all_data,
entry_point = entry_point,
templated_args = [
src,
source_map,
golden_file,
"%d" % max_percentage_diff,
"%d" % max_byte_diff,
"false",
],
**kwargs
)
nodejs_binary(
name = "%s.accept" % name,
testonly = True,
data = all_data,
entry_point = entry_point,
templated_args = [src, source_map, golden_file, "0", "0", "true"],
**kwargs
)