Skip to content

Commit 153fc61

Browse files
crisbetothePunderWoman
authored andcommitted
build: reuse fake core in type checking tests (#54344)
Currently we have two fake copies of `@angular/core` in the compiler tests which can be out of sync and cause inconsistent tests. These changes reuse a single copy instead. PR Close #54344
1 parent 35c617c commit 153fc61

File tree

15 files changed

+63
-141
lines changed

15 files changed

+63
-141
lines changed

packages/compiler-cli/src/ngtsc/testing/fake_core/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ export interface WritableSignal<T> extends Signal<T> {
138138
asReadonly(): Signal<T>;
139139
}
140140

141-
// Note: needs to be kept in sync with the copies in `render3/reactivity/signal.ts` and
142-
// `ngtsc/typecheck/testing/index.ts` to ensure consistent tests.
141+
// Note: needs to be kept in sync with the copies in `render3/reactivity/signal.ts`.
143142
export function ɵunwrapWritableSignal<T>(value: T|{[WRITABLE_SIGNAL]: T}): T {
144143
return null!;
145144
}
@@ -217,7 +216,20 @@ export const viewChildren: any = null!;
217216
export const contentChild: any = null!;
218217
export const contentChildren: any = null!;
219218

219+
export interface OutputEmitter<T> {
220+
emit(value: T): void;
221+
subscribe(listener: (v: T) => void): void;
222+
}
223+
220224
/** Initializer-based output() API. */
221-
export function output<T>(_opts?: {alias?: string}): EventEmitter<T> {
225+
export function output<T>(_opts?: {alias?: string}): OutputEmitter<T> {
226+
return null!;
227+
}
228+
229+
export interface CreateComputedOptions<T> {
230+
equal?: (a: T, b: T) => boolean;
231+
}
232+
233+
export function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {
222234
return null!;
223235
}

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/interpolated_signal_not_invoked/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/invalid_banana_in_box/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/missing_control_flow_directive/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/missing_ngforof_let/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/nullish_coalescing_not_nullable/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/optional_chain_not_nullable/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/skip_hydration_not_static/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/suffix_not_supported/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

packages/compiler-cli/src/ngtsc/typecheck/extended/test/checks/text_attribute_not_binding/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ts_library(
2121
jasmine_node_test(
2222
name = "test",
2323
bootstrap = ["//tools/testing:node_no_angular"],
24+
data = [
25+
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
26+
],
2427
deps = [
2528
":test_lib",
2629
],

0 commit comments

Comments
 (0)