mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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:
parent
68597bb0ca
commit
dd0fc0f237
4 changed files with 55 additions and 0 deletions
29
packages/bazel/test/types_bundle/BUILD.bazel
Normal file
29
packages/bazel/test/types_bundle/BUILD.bazel
Normal 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",
|
||||
)
|
||||
11
packages/bazel/test/types_bundle/bundle_entry.ts
Normal file
11
packages/bazel/test/types_bundle/bundle_entry.ts
Normal 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;
|
||||
6
packages/bazel/test/types_bundle/expected_types_bundle.d.ts
vendored
Normal file
6
packages/bazel/test/types_bundle/expected_types_bundle.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export declare const hello = 1;
|
||||
|
||||
|
||||
export declare const transitiveExport = "transitive";
|
||||
|
||||
export { }
|
||||
9
packages/bazel/test/types_bundle/transitive_fixture.ts
Normal file
9
packages/bazel/test/types_bundle/transitive_fixture.ts
Normal 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';
|
||||
Loading…
Reference in a new issue