Since we no longer hardcode the `package.json` for entry-points, a bug has appeared for `ng_package` in Ivy. The `package.json` files are populated incorrectly with Ivy as the flat module bundle name is not propagated from `ng_module` to the `ng_package` rule. The rule then guesses the index file to `index.js` and does not respect the flat module bundle shim. PR Close #36944
		
			
				
	
	
		
			98 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| load("//tools:defaults.bzl", "jasmine_node_test", "nodejs_binary", "ts_library")
 | |
| 
 | |
| exports_files(["package.json"])
 | |
| 
 | |
| # The tests in this package must run in separate targets, since they change
 | |
| # working directory and therefore have mutable global state that causes test
 | |
| # isolation failures.
 | |
| 
 | |
| ts_library(
 | |
|     name = "core_spec_lib",
 | |
|     testonly = True,
 | |
|     srcs = ["core_package.spec.ts"],
 | |
|     deps = [
 | |
|         "//packages:types",
 | |
|         "//packages/private/testing",
 | |
|         "@npm//@types/shelljs",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| jasmine_node_test(
 | |
|     name = "core_package",
 | |
|     srcs = [":core_spec_lib"],
 | |
|     data = [
 | |
|         "//packages/core:npm_package",
 | |
|         "@npm//@types/shelljs",
 | |
|         "@npm//shelljs",
 | |
|     ],
 | |
|     # The "ng_package" rule currently does not properly handle flat module
 | |
|     # bundles which the common package tests rely on. We temporarily disable
 | |
|     # this test until we fix `ng_package` for Ivy. Tracked with: FW-2144.
 | |
|     tags = ["fixme-ivy-aot"],
 | |
| )
 | |
| 
 | |
| ts_library(
 | |
|     name = "common_spec_lib",
 | |
|     testonly = True,
 | |
|     srcs = ["common_package.spec.ts"],
 | |
|     deps = [
 | |
|         "//packages:types",
 | |
|         "//packages/private/testing",
 | |
|         "@npm//@types/shelljs",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| jasmine_node_test(
 | |
|     name = "common_package",
 | |
|     srcs = [":common_spec_lib"],
 | |
|     data = [
 | |
|         "//packages/common:npm_package",
 | |
|         "@npm//shelljs",
 | |
|     ],
 | |
|     # The "ng_package" rule currently does not properly handle flat module
 | |
|     # bundles which the common package tests rely on. We temporarily disable
 | |
|     # this test until we fix `ng_package` for Ivy. Tracked with: FW-2144.
 | |
|     tags = ["fixme-ivy-aot"],
 | |
| )
 | |
| 
 | |
| ts_library(
 | |
|     name = "example_spec_lib",
 | |
|     testonly = True,
 | |
|     srcs = ["example_package.spec.ts"],
 | |
|     deps = [
 | |
|         "//packages:types",
 | |
|         "@npm//@types/diff",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| jasmine_node_test(
 | |
|     name = "example_package",
 | |
|     srcs = [":example_spec_lib"],
 | |
|     data = [
 | |
|         "example_package.golden",
 | |
|         "example_with_ts_library_package.golden",
 | |
|         "//packages/bazel/test/ng_package/example:npm_package",
 | |
|         "//packages/bazel/test/ng_package/example-with-ts-library:npm_package",
 | |
|     ],
 | |
|     # We don't want to run the example_package golden test with Ivy yet. Currently the golden
 | |
|     # file is based on non-ivy output and therefore won't work for ngc and Ivy at the same time.
 | |
|     # TODO: We should be able to have another golden for ivy-aot as well.
 | |
|     tags = ["no-ivy-aot"],
 | |
|     deps = ["@npm//diff"],
 | |
| )
 | |
| 
 | |
| nodejs_binary(
 | |
|     name = "example_package.accept",
 | |
|     testonly = True,
 | |
|     data = [
 | |
|         "example_package.golden",
 | |
|         "example_with_ts_library_package.golden",
 | |
|         ":example_spec_lib",
 | |
|         "//packages/bazel/test/ng_package/example:npm_package",
 | |
|         "//packages/bazel/test/ng_package/example-with-ts-library:npm_package",
 | |
|         "@npm//diff",
 | |
|     ],
 | |
|     entry_point = ":example_package.spec.ts",
 | |
|     templated_args = ["--accept"],
 | |
| )
 |