| 
									
										
										
										
											2016-10-23 22:37:15 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * 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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | const glob = require('glob'); | 
					
						
							| 
									
										
										
										
											2016-08-19 12:10:53 -07:00
										 |  |  | require('zone.js/dist/zone-node.js'); | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | const JasmineRunner = require('jasmine'); | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | require('zone.js/dist/long-stack-trace-zone.js'); | 
					
						
							| 
									
										
										
										
											2017-04-27 11:44:14 -07:00
										 |  |  | require('zone.js/dist/task-tracking.js'); | 
					
						
							| 
									
										
										
										
											2016-08-19 14:35:26 -07:00
										 |  |  | require('zone.js/dist/proxy.js'); | 
					
						
							| 
									
										
										
										
											2016-08-19 12:10:53 -07:00
										 |  |  | require('zone.js/dist/sync-test.js'); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | require('zone.js/dist/async-test.js'); | 
					
						
							|  |  |  | require('zone.js/dist/fake-async-test.js'); | 
					
						
							| 
									
										
										
										
											2018-07-06 09:13:25 +03:00
										 |  |  | const {generateSeed} = require('../../../tools/jasmine-seed-generator'); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | // Let TypeScript know this is a module
 | 
					
						
							|  |  |  | export {}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const jrunner = new JasmineRunner({projectBaseDir: path.resolve(__dirname, '../../')}); | 
					
						
							| 
									
										
										
										
											2016-08-19 12:10:53 -07:00
										 |  |  | (global as any)['jasmine'] = jrunner.jasmine; | 
					
						
							|  |  |  | require('zone.js/dist/jasmine-patch.js'); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | // Turn on full stack traces in errors to help debugging
 | 
					
						
							| 
									
										
										
										
											2016-01-22 10:51:16 -08:00
										 |  |  | (<any>Error)['stackTraceLimit'] = Infinity; | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | // Config the test runner
 | 
					
						
							|  |  |  | jrunner.jasmine.DEFAULT_TIMEOUT_INTERVAL = 100; | 
					
						
							|  |  |  | jrunner.loadConfig({ | 
					
						
							| 
									
										
										
										
											2018-07-06 09:13:25 +03:00
										 |  |  |   random: true, | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  |   spec_dir: '', | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2018-07-06 09:13:25 +03:00
										 |  |  | jrunner.seed(generateSeed('cjs-jasmine/index-tools')); | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1}); | 
					
						
							|  |  |  | jrunner.onComplete((passed: boolean) => process.exit(passed ? 0 : 1)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | // Support passing multiple globs
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | const rootDir = process.cwd(); | 
					
						
							|  |  |  | const globsIndex = process.argv.indexOf('--'); | 
					
						
							|  |  |  | const globs = (globsIndex === -1) ? [process.argv[2]] : process.argv.slice(globsIndex + 1); | 
					
						
							|  |  |  | const specFiles = globs.map(globstr => glob.sync(globstr, {cwd: rootDir}) as string[]) | 
					
						
							|  |  |  |                       .reduce((allPaths, paths) => allPaths.concat(paths), []); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | // Load helpers and spec files
 | 
					
						
							|  |  |  | const rootDirRequire = (relativePath: string) => require(path.join(rootDir, relativePath)); | 
					
						
							|  |  |  | specFiles.forEach(rootDirRequire); | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:10:16 +03:00
										 |  |  | // Run the tests
 | 
					
						
							| 
									
										
										
										
											2016-05-03 09:24:09 -07:00
										 |  |  | jrunner.execute(); |