test(zone.js): add zone.js externs test (#39108)
Add back the zone.js externs file test for google closure compiler. The test compiles a test program with and without `zone_externs`. 1. With `zone_externs`, the code should keep the APIs defined in the `zone_externs`. 2. Without `zone_externs`, the code will not keep these APIs. PR Close #39108
This commit is contained in:
committed by
Alex Rickabaugh
parent
e44e10bb81
commit
6085d2acc9
@@ -1,10 +1,10 @@
|
||||
# compile closure test source file
|
||||
$(npm bin)/tsc -p .
|
||||
# Run the Google Closure compiler java runnable with zone externs
|
||||
java -jar node_modules/google-closure-compiler/compiler.jar --flagfile 'scripts/closure/closure_flagfile' --externs 'lib/closure/zone_externs.js'
|
||||
java -jar ./node_modules/google-closure-compiler-java/compiler.jar --flagfile './scripts/closure/closure_flagfile' --externs './lib/closure/zone_externs.js' --externs './node_modules/@externs/nodejs/v8/global.js' --process_common_js_modules
|
||||
|
||||
# the names of Zone exposed API should be kept correctly with zone externs, test program should exit with 0.
|
||||
node build/closure/closure-bundle.js
|
||||
node build/closure/zone-closure-bundle.js
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
@@ -15,10 +15,9 @@ else
|
||||
fi
|
||||
|
||||
# Run the Google Closure compiler java runnable without zone externs.
|
||||
java -jar node_modules/google-closure-compiler/compiler.jar --flagfile 'scripts/closure/closure_flagfile'
|
||||
java -jar node_modules/google-closure-compiler-java/compiler.jar --flagfile 'scripts/closure/closure_flagfile' --externs './node_modules/@externs/nodejs/v8/global.js' --process_common_js_modules
|
||||
|
||||
# the names of Zone exposed API should be renamed and fail to be executed, test program should exit with 1.
|
||||
node build/closure/closure-bundle.js
|
||||
node build/closure/zone-closure-bundle.js
|
||||
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
--compilation_level ADVANCED_OPTIMIZATIONS
|
||||
--js_output_file "build/closure/closure-bundle.js"
|
||||
--js_output_file "build/closure/zone-closure-bundle.js"
|
||||
--rewrite_polyfills false
|
||||
--js "build/test/closure/zone.js"
|
||||
--js "build/test/closure/zone.closure.js"
|
||||
--formatting PRETTY_PRINT
|
||||
--formatting PRETTY_PRINT
|
||||
|
||||
Reference in New Issue
Block a user