test: add test for new types_bundle rule from Angular bazel package (#45405)

Adds a little golden test for the new `types_bundle` rule that ensures
the rule works at a general level. This rule will be useful for non-APF
ESM packages like the Angular compiler-cli (for which we also want to
bundle types to make them compatible with TypeScripts ESM type
resolution)

PR Close #45405
This commit is contained in:
Paul Gschwendtner 2022-04-14 19:52:33 +00:00 committed by Andrew Scott
parent 68597bb0ca
commit dd0fc0f237
4 changed files with 55 additions and 0 deletions

View file

@ -0,0 +1,29 @@
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
load("//packages/bazel/src/types_bundle:index.bzl", "types_bundle")
load("//tools:defaults.bzl", "ts_library")
package(default_testonly = True)
ts_library(
name = "test_transitive_lib",
srcs = ["transitive_fixture.ts"],
)
ts_library(
name = "test_lib",
srcs = ["bundle_entry.ts"],
deps = [":test_transitive_lib"],
)
types_bundle(
name = "bundled_types",
entry_point = "bundle_entry.d.ts",
output_name = "output_index.d.ts",
deps = [":test_lib"],
)
generated_file_test(
name = "test",
src = "expected_types_bundle.d.ts",
generated = ":bundled_types",
)

View file

@ -0,0 +1,11 @@
/**
* @license
* 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
*/
export {transitiveExport} from './transitive_fixture';
export const hello = 1;

View file

@ -0,0 +1,6 @@
export declare const hello = 1;
export declare const transitiveExport = "transitive";
export { }

View file

@ -0,0 +1,9 @@
/**
* @license
* 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
*/
export const transitiveExport = 'transitive';