ngtsc has a robust suite of testing utilities, designed for in-memory testing of a TypeScript compiler. Previously these utilities lived in the `test` directory for the compiler-cli package. This commit moves those utilities to an `ngtsc/testing` package, enabling them to be depended on separately and opening the door for using them from the upcoming language server testing infrastructure. As part of this refactoring, the `fake_core` package (a lightweight API replacement for @angular/core) is expanded to include functionality needed for Language Service test use cases. PR Close #39594
		
			
				
	
	
		
			109 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
 | |
| load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test")
 | |
| 
 | |
| # Test that should only be run in node
 | |
| NODE_ONLY = [
 | |
|     "**/*_node_only_spec.ts",
 | |
|     "aot/**/*.ts",
 | |
| ]
 | |
| 
 | |
| UTILS = [
 | |
|     "aot/test_util.ts",
 | |
| ]
 | |
| 
 | |
| circular_dependency_test(
 | |
|     name = "circular_deps_test",
 | |
|     entry_point = "angular/packages/compiler/index.js",
 | |
|     deps = ["//packages/compiler"],
 | |
| )
 | |
| 
 | |
| ts_library(
 | |
|     name = "test_utils",
 | |
|     testonly = True,
 | |
|     srcs = UTILS,
 | |
|     visibility = [
 | |
|         "//packages/compiler-cli/test:__subpackages__",
 | |
|         "//packages/compiler/test:__subpackages__",
 | |
|     ],
 | |
|     deps = [
 | |
|         "//packages:types",
 | |
|         "//packages/compiler",
 | |
|         "//packages/compiler-cli",
 | |
|         "//packages/compiler-cli/src/ngtsc/testing",
 | |
|         "@npm//typescript",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| ts_library(
 | |
|     name = "test_lib",
 | |
|     testonly = True,
 | |
|     srcs = glob(
 | |
|         ["**/*.ts"],
 | |
|         exclude = NODE_ONLY + UTILS,
 | |
|     ),
 | |
|     deps = [
 | |
|         "//packages:types",
 | |
|         "//packages/common",
 | |
|         "//packages/compiler",
 | |
|         "//packages/compiler/test/expression_parser/utils",
 | |
|         "//packages/compiler/test/ml_parser/util",
 | |
|         "//packages/compiler/testing",
 | |
|         "//packages/core",
 | |
|         "//packages/core/src/compiler",
 | |
|         "//packages/core/testing",
 | |
|         "//packages/platform-browser",
 | |
|         "//packages/platform-browser-dynamic",
 | |
|         "//packages/platform-browser/testing",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| ts_library(
 | |
|     name = "test_node_only_lib",
 | |
|     testonly = True,
 | |
|     srcs = glob(
 | |
|         NODE_ONLY,
 | |
|         exclude = UTILS,
 | |
|     ),
 | |
|     deps = [
 | |
|         ":test_lib",
 | |
|         ":test_utils",
 | |
|         "//packages/compiler",
 | |
|         "//packages/compiler-cli",
 | |
|         "//packages/compiler/test/expression_parser/utils",
 | |
|         "//packages/compiler/testing",
 | |
|         "//packages/core",
 | |
|         "@npm//typescript",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| jasmine_node_test(
 | |
|     name = "test",
 | |
|     bootstrap = ["//tools/testing:node_es5"],
 | |
|     data = [
 | |
|         "//packages/animations:npm_package",
 | |
|         "//packages/common:npm_package",
 | |
|         "//packages/core:npm_package",
 | |
|     ],
 | |
|     tags = [
 | |
|         # Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy.
 | |
|         "no-ivy-aot",
 | |
|     ],
 | |
|     deps = [
 | |
|         ":test_lib",
 | |
|         ":test_node_only_lib",
 | |
|         "@npm//base64-js",
 | |
|         "@npm//source-map",
 | |
|     ],
 | |
| )
 | |
| 
 | |
| karma_web_test_suite(
 | |
|     name = "test_web",
 | |
|     tags = [
 | |
|         # Disabled as these tests pertain to the old ngc compilation and are not relevant in Ivy.
 | |
|         "no-ivy-aot",
 | |
|     ],
 | |
|     deps = [
 | |
|         ":test_lib",
 | |
|     ],
 | |
| )
 |