| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | # Copyright Google Inc. 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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | """This test verifies that a set of top level symbols from a javascript file match a gold file.
 | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  | # This does a deep import under //internal because of not wanting the wrapper macro | 
					
						
							| 
									
										
										
										
											2018-03-21 10:55:14 -07:00
										 |  |  | # because it introduces an extra target_bin target. | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  | load("@build_bazel_rules_nodejs//internal/node:node.bzl", "nodejs_binary", "nodejs_test") | 
					
						
							| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 18:11:32 -07:00
										 |  |  | DEFAULT_NODE_MODULES = "@angular_deps//:node_modules" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def js_expected_symbol_test(name, src, golden, node_modules = DEFAULT_NODE_MODULES, **kwargs): | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     """This test verifies that a set of top level symbols from a javascript file match a gold file.
 | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     all_data = [src, golden] | 
					
						
							|  |  |  |     all_data += [Label("//tools/symbol-extractor:lib")] | 
					
						
							|  |  |  |     all_data += [Label("@bazel_tools//tools/bash/runfiles")] | 
					
						
							|  |  |  |     entry_point = "angular/tools/symbol-extractor/cli.js" | 
					
						
							| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     nodejs_test( | 
					
						
							|  |  |  |         name = name, | 
					
						
							|  |  |  |         data = all_data, | 
					
						
							|  |  |  |         entry_point = entry_point, | 
					
						
							|  |  |  |         templated_args = ["$(location %s)" % src, "$(location %s)" % golden], | 
					
						
							| 
									
										
										
										
											2018-09-11 18:11:32 -07:00
										 |  |  |         node_modules = node_modules, | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         **kwargs | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2018-03-21 10:55:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     nodejs_binary( | 
					
						
							|  |  |  |         name = name + ".accept", | 
					
						
							| 
									
										
										
										
											2018-08-14 16:18:26 -07:00
										 |  |  |         testonly = True, | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         data = all_data, | 
					
						
							|  |  |  |         entry_point = entry_point, | 
					
						
							|  |  |  |         templated_args = ["$(location %s)" % src, "$(location %s)" % golden, "--accept"], | 
					
						
							| 
									
										
										
										
											2018-09-11 18:11:32 -07:00
										 |  |  |         node_modules = node_modules, | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         **kwargs | 
					
						
							|  |  |  |     ) |