Skip to content

Commit

Permalink
build: rework signals acceptance tests build setup (angular#54213)
Browse files Browse the repository at this point in the history
* Renames the `input_signals` directory to `signals` so it can be reused for other tests.
* Reworks the build file to allow multiple test files.

PR Close angular#54213
  • Loading branch information
crisbeto authored and thePunderWoman committed Feb 2, 2024
1 parent bdf6927 commit fc5fe3e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ng_mo

package(default_visibility = ["//visibility:private"])

TEST_FILE = "signal_inputs_spec"
TEST_FILES = [
"signal_inputs_spec",
]

TEST_DEPS = [
"//packages/core",
Expand All @@ -12,7 +14,7 @@ TEST_DEPS = [
ts_library(
name = "test_compiler_lib",
testonly = True,
srcs = ["signal_inputs_test_compiler.ts"],
srcs = ["authoring_test_compiler.ts"],
deps = [
"//packages/compiler-cli",
"//packages/compiler-cli/src/ngtsc/partial_evaluator",
Expand All @@ -26,32 +28,29 @@ nodejs_binary(
name = "test_compiler",
testonly = True,
data = [":test_compiler_lib"],
entry_point = ":signal_inputs_test_compiler.ts",
entry_point = ":authoring_test_compiler.ts",
)

npm_package_bin(
name = "processed_test_sources",
testonly = True,
outs = ["tansformed_%s.ts" % TEST_FILE],
args = [
"$(execpath %s.ts)" % TEST_FILE,
"$@",
],
data = ["%s.ts" % TEST_FILE],
outs = ["transformed_%s.ts" % file for file in TEST_FILES],
args = ["$(execpath %s.ts)" % file for file in TEST_FILES] + ["$@"],
data = ["%s.ts" % file for file in TEST_FILES],
tool = ":test_compiler",
)

ts_library(
name = "test_jit_lib",
testonly = True,
srcs = ["tansformed_%s.ts" % TEST_FILE],
srcs = ["transformed_%s.ts" % file for file in TEST_FILES],
deps = TEST_DEPS,
)

ng_module(
name = "test_lib",
testonly = True,
srcs = ["%s.ts" % TEST_FILE],
srcs = ["%s.ts" % file for file in TEST_FILES],
deps = TEST_DEPS,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

import {PartialEvaluator} from '@angular/compiler-cli/src/ngtsc/partial_evaluator';
import {TypeScriptReflectionHost} from '@angular/compiler-cli/src/ngtsc/reflection';
import {getInitializerApiJitTransform} from '@angular/compiler-cli/src/transformers/jit_transforms';
import fs from 'fs';
Expand All @@ -27,7 +26,6 @@ async function main() {
});

const host = new TypeScriptReflectionHost(program.getTypeChecker());
const evaluator = new PartialEvaluator(host, program.getTypeChecker(), null);
const outputFile = ts.transform(
program.getSourceFile(inputTsExecPath)!,
[getInitializerApiJitTransform(host, /* isCore */ false)], program.getCompilerOptions());
Expand Down

0 comments on commit fc5fe3e

Please # to comment.