| 
									
										
										
										
											2016-10-04 20:39:20 -07: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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:13:25 +03:00
										 |  |  | const browserProvidersConf = require('./browser-providers.conf'); | 
					
						
							|  |  |  | const {generateSeed} = require('./tools/jasmine-seed-generator'); | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  | // Karma configuration
 | 
					
						
							|  |  |  | // Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
 | 
					
						
							|  |  |  | module.exports = function(config) { | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |   const conf = { | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  |     frameworks: ['jasmine'], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-06 09:13:25 +03:00
										 |  |  |     client: { | 
					
						
							|  |  |  |       jasmine: { | 
					
						
							|  |  |  |         random: true, | 
					
						
							|  |  |  |         seed: generateSeed('karma-js.conf'), | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  |     files: [ | 
					
						
							| 
									
										
										
										
											2014-10-06 17:35:00 -07:00
										 |  |  |       // Sources and specs.
 | 
					
						
							| 
									
										
										
										
											2015-08-20 17:05:05 +02:00
										 |  |  |       // Loaded through the System loader, in `test-main.js`.
 | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       {pattern: 'dist/all/@angular/**/*.js', included: false, watched: true}, | 
					
						
							| 
									
										
										
										
											2014-10-06 17:35:00 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-15 19:21:18 +02:00
										 |  |  |       // Serve AngularJS for `ngUpgrade` testing.
 | 
					
						
							| 
									
										
										
										
											2018-12-17 18:28:06 +01:00
										 |  |  |       {pattern: 'node_modules/angular-1.5/angular?(.min).js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2018-02-15 19:21:18 +02:00
										 |  |  |       {pattern: 'node_modules/angular-mocks-1.5/angular-mocks.js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2018-12-17 18:28:06 +01:00
										 |  |  |       {pattern: 'node_modules/angular-1.6/angular?(.min).js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2018-07-31 15:10:13 +03:00
										 |  |  |       {pattern: 'node_modules/angular-mocks-1.6/angular-mocks.js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2018-12-17 18:28:06 +01:00
										 |  |  |       {pattern: 'node_modules/angular/angular?(.min).js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2018-02-15 19:21:18 +02:00
										 |  |  |       {pattern: 'node_modules/angular-mocks/angular-mocks.js', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2016-12-17 01:14:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-15 19:21:18 +02:00
										 |  |  |       'node_modules/core-js/client/core.js', | 
					
						
							| 
									
										
										
										
											2019-10-06 12:06:53 +09:00
										 |  |  |       'dist/bin/packages/zone.js/npm_package/dist/zone.js', | 
					
						
							|  |  |  |       'dist/bin/packages/zone.js/npm_package/dist/zone-testing.js', | 
					
						
							|  |  |  |       'dist/bin/packages/zone.js/npm_package/dist/task-tracking.js', | 
					
						
							| 
									
										
										
										
											2015-08-05 10:32:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 18:52:32 +01:00
										 |  |  |       // Including systemjs because it defines `__eval`, which produces correct stack traces.
 | 
					
						
							| 
									
										
										
										
											2017-09-02 02:30:37 +09:00
										 |  |  |       'test-events.js', | 
					
						
							| 
									
										
										
										
											2016-12-17 01:14:16 +02:00
										 |  |  |       'shims_for_IE.js', | 
					
						
							|  |  |  |       'node_modules/systemjs/dist/system.src.js', | 
					
						
							| 
									
										
										
										
											2018-02-28 09:45:11 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       // Serve polyfills necessary for testing the `elements` package.
 | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         pattern: 'node_modules/@webcomponents/custom-elements/**/*.js', | 
					
						
							|  |  |  |         included: false, | 
					
						
							|  |  |  |         watched: false | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       {pattern: 'node_modules/mutation-observer/index.js', included: false, watched: false}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-30 17:22:52 -08:00
										 |  |  |       {pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true}, | 
					
						
							| 
									
										
										
										
											2016-12-17 01:14:16 +02:00
										 |  |  |       'node_modules/reflect-metadata/Reflect.js', | 
					
						
							|  |  |  |       'tools/build/file2modulename.js', | 
					
						
							|  |  |  |       'test-main.js', | 
					
						
							| 
									
										
										
										
											2017-03-15 13:40:24 -07:00
										 |  |  |       {pattern: 'dist/all/@angular/empty.*', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2017-03-07 11:04:30 -08:00
										 |  |  |       {pattern: 'packages/platform-browser/test/static_assets/**', included: false, watched: false}, | 
					
						
							| 
									
										
										
										
											2016-12-17 01:14:16 +02:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2017-03-07 11:04:30 -08:00
										 |  |  |         pattern: 'packages/platform-browser/test/browser/static_assets/**', | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |         included: false, | 
					
						
							|  |  |  |         watched: false, | 
					
						
							| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  |     ], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |     exclude: [ | 
					
						
							| 
									
										
										
										
											2017-12-16 11:35:47 -08:00
										 |  |  |       'dist/all/@angular/_testing_init/**', | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       'dist/all/@angular/**/e2e_test/**', | 
					
						
							| 
									
										
										
										
											2016-12-12 10:49:17 -08:00
										 |  |  |       'dist/all/@angular/**/*node_only_spec.js', | 
					
						
							| 
									
										
										
										
											2016-09-09 16:54:26 -07:00
										 |  |  |       'dist/all/@angular/benchpress/**', | 
					
						
							| 
									
										
										
										
											2016-06-02 11:33:53 -07:00
										 |  |  |       'dist/all/@angular/compiler-cli/**', | 
					
						
							| 
									
										
										
										
											2018-04-06 09:53:10 -07:00
										 |  |  |       'dist/all/@angular/compiler-cli/src/ngtsc/**', | 
					
						
							| 
									
										
										
										
											2018-07-12 15:10:55 -07:00
										 |  |  |       'dist/all/@angular/compiler-cli/test/compliance/**', | 
					
						
							| 
									
										
										
										
											2018-04-06 09:53:10 -07:00
										 |  |  |       'dist/all/@angular/compiler-cli/test/ngtsc/**', | 
					
						
							| 
									
										
										
										
											2016-11-14 17:37:47 -08:00
										 |  |  |       'dist/all/@angular/compiler/test/aot/**', | 
					
						
							| 
									
										
										
										
											2017-11-20 10:21:17 -08:00
										 |  |  |       'dist/all/@angular/compiler/test/render3/**', | 
					
						
							| 
									
										
										
										
											2018-02-02 15:25:33 -08:00
										 |  |  |       'dist/all/@angular/core/test/bundling/**', | 
					
						
							| 
									
										
										
										
											2018-07-13 10:51:54 +02:00
										 |  |  |       'dist/all/@angular/core/test/render3/ivy/**', | 
					
						
							| 
									
										
										
										
											2019-10-24 20:28:11 -07:00
										 |  |  |       'dist/all/@angular/core/test/render3/perf/**', | 
					
						
							| 
									
										
										
										
											2018-04-03 14:52:33 -07:00
										 |  |  |       'dist/all/@angular/elements/schematics/**', | 
					
						
							| 
									
										
										
										
											2016-09-09 16:54:26 -07:00
										 |  |  |       'dist/all/@angular/examples/**/e2e_test/*', | 
					
						
							| 
									
										
										
										
											2016-11-22 09:10:23 -08:00
										 |  |  |       'dist/all/@angular/language-service/**', | 
					
						
							| 
									
										
										
										
											2019-07-30 18:02:17 +01:00
										 |  |  |       'dist/all/@angular/localize/**/test/**', | 
					
						
							| 
									
										
										
										
											2019-09-20 16:05:45 +01:00
										 |  |  |       'dist/all/@angular/localize/schematics/**', | 
					
						
							| 
									
										
										
										
											2017-11-07 10:21:48 -07:00
										 |  |  |       'dist/all/@angular/router/**/test/**', | 
					
						
							| 
									
										
										
										
											2016-09-07 16:04:33 -07:00
										 |  |  |       'dist/all/@angular/platform-browser/testing/e2e_util.js', | 
					
						
							| 
									
										
										
										
											2016-09-09 16:54:26 -07:00
										 |  |  |       'dist/all/angular1_router.js', | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       'dist/examples/**/e2e_test/**', | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2015-01-08 10:02:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-27 16:09:09 +01:00
										 |  |  |     customLaunchers: browserProvidersConf.customLaunchers, | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-23 14:58:18 -08:00
										 |  |  |     plugins: [ | 
					
						
							|  |  |  |       'karma-jasmine', | 
					
						
							|  |  |  |       'karma-browserstack-launcher', | 
					
						
							|  |  |  |       'karma-sauce-launcher', | 
					
						
							|  |  |  |       'karma-chrome-launcher', | 
					
						
							|  |  |  |       'karma-sourcemap-loader', | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     preprocessors: { | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       '**/*.js': ['sourcemap'], | 
					
						
							| 
									
										
										
										
											2015-11-23 14:58:18 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-30 23:49:37 -07:00
										 |  |  |     // Bazel inter-op: Allow tests to request resources from either
 | 
					
						
							|  |  |  |     //   /base/node_modules/path/to/thing
 | 
					
						
							|  |  |  |     // or
 | 
					
						
							|  |  |  |     //   /base/angular/node_modules/path/to/thing
 | 
					
						
							|  |  |  |     // This can be removed when all karma tests are run under Bazel, then we
 | 
					
						
							|  |  |  |     // don't need this entire config file.
 | 
					
						
							|  |  |  |     proxies: { | 
					
						
							|  |  |  |       '/base/angular/': '/base/', | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  |       '/base/npm/': '/base/', | 
					
						
							| 
									
										
										
										
											2018-05-30 23:49:37 -07:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-09 17:44:55 +03:00
										 |  |  |     reporters: ['dots'], | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |     sauceLabs: { | 
					
						
							|  |  |  |       testName: 'Angular2', | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       retryLimit: 3, | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |       startConnect: false, | 
					
						
							|  |  |  |       recordVideo: false, | 
					
						
							|  |  |  |       recordScreenshots: false, | 
					
						
							| 
									
										
										
										
											2018-12-12 23:07:21 +01:00
										 |  |  |       idleTimeout: 600, | 
					
						
							|  |  |  |       commandTimeout: 600, | 
					
						
							|  |  |  |       maxDuration: 5400, | 
					
						
							| 
									
										
										
										
											2014-09-29 14:20:23 -07:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-27 16:09:09 +01:00
										 |  |  |     browserStack: { | 
					
						
							|  |  |  |       project: 'Angular2', | 
					
						
							|  |  |  |       startTunnel: false, | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       retryLimit: 3, | 
					
						
							| 
									
										
										
										
											2016-11-10 11:58:06 -08:00
										 |  |  |       timeout: 1800, | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |       pollingTimeout: 10000, | 
					
						
							| 
									
										
										
										
											2015-10-27 16:09:09 +01:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |     // Try "websocket" for a faster transmission first. Fallback to "polling" if necessary.
 | 
					
						
							|  |  |  |     transports: ['websocket', 'polling'], | 
					
						
							| 
									
										
										
										
											2014-10-09 13:50:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-01 22:22:26 -07:00
										 |  |  |     port: 9876, | 
					
						
							| 
									
										
										
										
											2016-11-10 11:58:06 -08:00
										 |  |  |     captureTimeout: 180000, | 
					
						
							|  |  |  |     browserDisconnectTimeout: 180000, | 
					
						
							| 
									
										
										
										
											2016-10-04 20:39:20 -07:00
										 |  |  |     browserDisconnectTolerance: 3, | 
					
						
							| 
									
										
										
										
											2016-11-10 11:58:06 -08:00
										 |  |  |     browserNoActivityTimeout: 300000, | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-21 10:57:56 -08:00
										 |  |  |   // When running under Bazel with karma_web_test, SAUCE_TUNNEL_IDENTIFIER and KARMA_WEB_TEST_MODE
 | 
					
						
							|  |  |  |   // will only be available when `--config=saucelabs` is set. See //:test_web_all target
 | 
					
						
							|  |  |  |   // and /.bazelrc.
 | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |   if (process.env['SAUCE_TUNNEL_IDENTIFIER']) { | 
					
						
							|  |  |  |     console.log(`SAUCE_TUNNEL_IDENTIFIER: ${process.env.SAUCE_TUNNEL_IDENTIFIER}`); | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-04 11:58:33 -08:00
										 |  |  |     const tunnelIdentifier = process.env['SAUCE_TUNNEL_IDENTIFIER']; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Setup the Saucelabs plugin so that it can launch browsers using the proper tunnel.
 | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |     conf.sauceLabs.build = tunnelIdentifier; | 
					
						
							|  |  |  |     conf.sauceLabs.tunnelIdentifier = tunnelIdentifier; | 
					
						
							| 
									
										
										
										
											2019-01-04 11:58:33 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Setup the Browserstack plugin so that it can launch browsers using the proper tunnel.
 | 
					
						
							|  |  |  |     // TODO: This is currently not used because BS doesn't run on the CI. Consider removing.
 | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |     conf.browserStack.build = tunnelIdentifier; | 
					
						
							|  |  |  |     conf.browserStack.tunnelIdentifier = tunnelIdentifier; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-01-04 11:58:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  |   if (process.env.KARMA_WEB_TEST_MODE) { | 
					
						
							|  |  |  |     // KARMA_WEB_TEST_MODE is used to setup karma to run in
 | 
					
						
							|  |  |  |     // SauceLabs or Browserstack
 | 
					
						
							|  |  |  |     console.log(`KARMA_WEB_TEST_MODE: ${process.env.KARMA_WEB_TEST_MODE}`); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     switch (process.env.KARMA_WEB_TEST_MODE) { | 
					
						
							|  |  |  |       case 'SL_REQUIRED': | 
					
						
							|  |  |  |         conf.browsers = browserProvidersConf.sauceAliases.CI_REQUIRED; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case 'SL_OPTIONAL': | 
					
						
							|  |  |  |         conf.browsers = browserProvidersConf.sauceAliases.CI_OPTIONAL; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case 'BS_REQUIRED': | 
					
						
							|  |  |  |         conf.browsers = browserProvidersConf.browserstackAliases.CI_REQUIRED; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case 'BS_OPTIONAL': | 
					
						
							|  |  |  |         conf.browsers = browserProvidersConf.browserstackAliases.CI_OPTIONAL; | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       default: | 
					
						
							|  |  |  |         throw new Error( | 
					
						
							|  |  |  |             `Unrecognized process.env.KARMA_WEB_TEST_MODE: ${process.env.KARMA_WEB_TEST_MODE}`); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     // Run the test locally
 | 
					
						
							|  |  |  |     conf.browsers = [process.env['DISPLAY'] ? 'Chrome' : 'ChromeHeadless']; | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-12-17 22:09:39 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   config.set(conf); | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  | }; |