2015-10-27 11:09:09 -04:00
|
|
|
var browserProvidersConf = require('./browser-providers.conf.js');
|
2015-11-23 17:58:18 -05:00
|
|
|
var internalAngularReporter = require('./tools/karma/reporter.js');
|
2015-06-02 10:29:09 -04:00
|
|
|
|
2014-09-25 17:04:46 -04:00
|
|
|
// Karma configuration
|
|
|
|
// Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
|
|
|
|
module.exports = function(config) {
|
|
|
|
config.set({
|
|
|
|
|
|
|
|
frameworks: ['jasmine'],
|
|
|
|
|
|
|
|
files: [
|
2014-10-06 20:35:00 -04:00
|
|
|
// Sources and specs.
|
2015-08-20 11:05:05 -04:00
|
|
|
// Loaded through the System loader, in `test-main.js`.
|
2016-04-28 20:50:03 -04:00
|
|
|
{pattern: 'dist/all/@angular/**/*.js', included: false, watched: true},
|
|
|
|
{pattern: 'dist/all/angular2/**/*.js', included: false, watched: true},
|
2014-10-06 20:35:00 -04:00
|
|
|
|
2015-09-16 17:50:03 -04:00
|
|
|
'node_modules/es6-shim/es6-shim.js',
|
2015-08-05 13:32:14 -04:00
|
|
|
// include Angular v1 for upgrade module testing
|
|
|
|
'node_modules/angular/angular.min.js',
|
2015-09-16 17:50:03 -04:00
|
|
|
|
2016-02-25 17:24:17 -05:00
|
|
|
'node_modules/zone.js/dist/zone.js',
|
2015-05-12 03:47:17 -04:00
|
|
|
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
2015-05-19 03:13:17 -04:00
|
|
|
'node_modules/zone.js/dist/jasmine-patch.js',
|
feat(tests): manage asynchronous tests using zones
Instead of using injectAsync and returning a promise, use the `async` function
to wrap tests. This will run the test inside a zone which does not complete
the test until all asynchronous tasks have been completed.
`async` may be used with the `inject` function, or separately.
BREAKING CHANGE:
`injectAsync` is now deprecated. Instead, use the `async` function
to wrap any asynchronous tests.
Before:
```
it('should wait for returned promises', injectAsync([FancyService], (service) => {
return service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
}));
it('should wait for returned promises', injectAsync([], () => {
return somePromise.then(() => { expect(true).toEqual(true); });
}));
```
After:
```
it('should wait for returned promises', async(inject([FancyService], (service) => {
service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
})));
// Note that if there is no injection, we no longer need `inject` OR `injectAsync`.
it('should wait for returned promises', async(() => {
somePromise.then() => { expect(true).toEqual(true); });
}));
```
Closes #7735
2016-03-23 13:59:38 -04:00
|
|
|
'node_modules/zone.js/dist/async-test.js',
|
2016-04-18 19:04:35 -04:00
|
|
|
'node_modules/zone.js/dist/fake-async-test.js',
|
2015-08-05 13:32:14 -04:00
|
|
|
|
2014-10-30 13:52:32 -04:00
|
|
|
// Including systemjs because it defines `__eval`, which produces correct stack traces.
|
2016-04-28 20:50:03 -04:00
|
|
|
'shims_for_IE.js',
|
2014-10-30 13:52:32 -04:00
|
|
|
'node_modules/systemjs/dist/system.src.js',
|
2015-11-30 20:22:52 -05:00
|
|
|
{pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true},
|
2015-04-28 21:17:00 -04:00
|
|
|
'node_modules/reflect-metadata/Reflect.js',
|
2014-12-05 19:26:30 -05:00
|
|
|
'tools/build/file2modulename.js',
|
2015-05-19 13:27:03 -04:00
|
|
|
'test-main.js',
|
2016-04-28 20:50:03 -04:00
|
|
|
{pattern: 'dist/all/empty.*', included: false, watched: false},
|
|
|
|
{pattern: 'modules/@angular/platform-browser/test/static_assets/**', included: false, watched: false},
|
2016-05-19 17:31:21 -04:00
|
|
|
{pattern: 'modules/@angular/platform-browser/test/browser/static_assets/**', included: false, watched: false}
|
2014-09-25 17:04:46 -04:00
|
|
|
],
|
|
|
|
|
2016-04-28 20:50:03 -04:00
|
|
|
exclude: [
|
|
|
|
'dist/all/@angular/**/e2e_test/**',
|
|
|
|
'dist/all/@angular/examples/**',
|
2016-05-03 12:24:09 -04:00
|
|
|
'dist/all/@angular/compiler_cli/**',
|
2016-04-28 20:50:03 -04:00
|
|
|
'dist/all/angular1_router.js',
|
|
|
|
'dist/all/@angular/platform-browser/testing/e2e_util.js'
|
|
|
|
],
|
2015-01-08 13:02:23 -05:00
|
|
|
|
2015-10-27 11:09:09 -04:00
|
|
|
customLaunchers: browserProvidersConf.customLaunchers,
|
2015-06-02 10:29:09 -04:00
|
|
|
|
2015-11-23 17:58:18 -05:00
|
|
|
plugins: [
|
|
|
|
'karma-jasmine',
|
|
|
|
'karma-browserstack-launcher',
|
|
|
|
'karma-sauce-launcher',
|
|
|
|
'karma-chrome-launcher',
|
|
|
|
'karma-sourcemap-loader',
|
|
|
|
internalAngularReporter
|
|
|
|
],
|
|
|
|
|
|
|
|
preprocessors: {
|
|
|
|
'**/*.js': ['sourcemap']
|
|
|
|
},
|
|
|
|
|
|
|
|
reporters: ['internal-angular'],
|
2015-06-02 10:29:09 -04:00
|
|
|
sauceLabs: {
|
|
|
|
testName: 'Angular2',
|
2016-04-28 20:50:03 -04:00
|
|
|
retryLimit: 3,
|
2015-06-02 10:29:09 -04:00
|
|
|
startConnect: false,
|
|
|
|
recordVideo: false,
|
|
|
|
recordScreenshots: false,
|
2015-09-02 23:58:02 -04:00
|
|
|
options: {
|
2016-05-09 19:47:26 -04:00
|
|
|
'selenium-version': '2.53.0',
|
2015-09-02 23:58:02 -04:00
|
|
|
'command-timeout': 600,
|
|
|
|
'idle-timeout': 600,
|
|
|
|
'max-duration': 5400
|
2015-06-02 10:29:09 -04:00
|
|
|
}
|
2014-09-29 17:20:23 -04:00
|
|
|
},
|
2015-06-02 10:29:09 -04:00
|
|
|
|
2015-10-27 11:09:09 -04:00
|
|
|
browserStack: {
|
|
|
|
project: 'Angular2',
|
|
|
|
startTunnel: false,
|
2016-04-28 20:50:03 -04:00
|
|
|
retryLimit: 3,
|
2015-11-06 04:55:04 -05:00
|
|
|
timeout: 600,
|
|
|
|
pollingTimeout: 10000
|
2015-10-27 11:09:09 -04:00
|
|
|
},
|
|
|
|
|
2015-08-24 20:24:01 -04:00
|
|
|
browsers: ['Chrome'],
|
2014-10-09 16:50:25 -04:00
|
|
|
|
2016-05-02 01:22:26 -04:00
|
|
|
port: 9876,
|
|
|
|
captureTimeout: 60000,
|
|
|
|
browserDisconnectTimeout : 60000,
|
|
|
|
browserDisconnectTolerance : 3,
|
|
|
|
browserNoActivityTimeout : 60000,
|
2014-09-25 17:04:46 -04:00
|
|
|
});
|
2015-06-02 10:29:09 -04:00
|
|
|
|
2015-10-27 11:09:09 -04:00
|
|
|
if (process.env.TRAVIS) {
|
|
|
|
var buildId = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
|
2016-04-28 20:50:03 -04:00
|
|
|
if (process.env.CI_MODE.startsWith('saucelabs')) {
|
2015-10-27 11:09:09 -04:00
|
|
|
config.sauceLabs.build = buildId;
|
|
|
|
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
|
|
|
|
|
|
|
// TODO(mlaval): remove once SauceLabs supports websockets.
|
|
|
|
// This speeds up the capturing a bit, as browsers don't even try to use websocket.
|
|
|
|
console.log('>>>> setting socket.io transport to polling <<<<');
|
|
|
|
config.transports = ['polling'];
|
|
|
|
}
|
2015-06-02 10:29:09 -04:00
|
|
|
|
2016-04-28 20:50:03 -04:00
|
|
|
if (process.env.CI_MODE.startsWith('browserstack')) {
|
2015-10-27 11:09:09 -04:00
|
|
|
config.browserStack.build = buildId;
|
|
|
|
config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
|
|
|
}
|
2015-06-02 10:29:09 -04:00
|
|
|
}
|
2014-09-25 17:04:46 -04:00
|
|
|
};
|