Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit eeec3b5

Browse files
committed
fix(test): karma-dist should test bundle under dist
1 parent c8c5990 commit eeec3b5

18 files changed

+425
-467
lines changed

gulpfile.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ function generateScript(inFile, outFile, minify, callback) {
4242
'rxjs/Observable': 'Rx',
4343
'rxjs/Subscriber': 'Rx',
4444
'rxjs/Subscription': 'Rx',
45+
'rxjs/Scheduler': 'Rx',
4546
'rxjs/scheduler/asap': 'Rx.Scheduler',
47+
'rxjs/scheduler/async': 'Rx.Scheduler',
4648
'rxjs/symbol/rxSubscriber': 'Rx.Symbol'
4749
}
4850
},
@@ -221,19 +223,23 @@ gulp.task('build/zone-patch-socket-io.min.js', ['compile-esm'], function(cb) {
221223
});
222224

223225
gulp.task('build/zone-patch-promise-testing.js', ['compile-esm'], function(cb) {
224-
return generateScript('./lib/testing/promise-testing.ts', 'zone-patch-promise-test.js', false, cb);
226+
return generateScript(
227+
'./lib/testing/promise-testing.ts', 'zone-patch-promise-test.js', false, cb);
225228
});
226229

227230
gulp.task('build/zone-patch-promise-testing.min.js', ['compile-esm'], function(cb) {
228-
return generateScript('./lib/testing/promise-testing.ts', 'zone-patch-promise-test.min.js', true, cb);
231+
return generateScript(
232+
'./lib/testing/promise-testing.ts', 'zone-patch-promise-test.min.js', true, cb);
229233
});
230234

231235
gulp.task('build/zone-patch-resize-observer.js', ['compile-esm'], function(cb) {
232-
return generateScript('./lib/browser/webapis-resize-observer.ts', 'zone-patch-resize-observer.js', false, cb);
236+
return generateScript(
237+
'./lib/browser/webapis-resize-observer.ts', 'zone-patch-resize-observer.js', false, cb);
233238
});
234239

235240
gulp.task('build/zone-patch-resize-observer.min.js', ['compile-esm'], function(cb) {
236-
return generateScript('./lib/browser/webapis-resize-observer.ts', 'zone-patch-resize-observer.min.js', true, cb);
241+
return generateScript(
242+
'./lib/browser/webapis-resize-observer.ts', 'zone-patch-resize-observer.min.js', true, cb);
237243
});
238244

239245
gulp.task('build/bluebird.js', ['compile-esm'], function(cb) {
@@ -245,11 +251,11 @@ gulp.task('build/bluebird.min.js', ['compile-esm'], function(cb) {
245251
});
246252

247253
gulp.task('build/zone-patch-jsonp.js', ['compile-esm'], function(cb) {
248-
return generateScript('./lib/extra/jsonp.ts', 'zone-patch-jsonp.js', false, cb);
254+
return generateScript('./lib/extra/jsonp.ts', 'zone-patch-jsonp.js', false, cb);
249255
});
250256

251257
gulp.task('build/zone-patch-jsonp.min.js', ['compile-esm'], function(cb) {
252-
return generateScript('./lib/extra/jsonp.ts', 'zone-patch-jsonp.min.js', true, cb);
258+
return generateScript('./lib/extra/jsonp.ts', 'zone-patch-jsonp.min.js', true, cb);
253259
});
254260

255261
gulp.task('build/jasmine-patch.js', ['compile-esm'], function(cb) {
@@ -323,11 +329,13 @@ gulp.task('build/rxjs.min.js', ['compile-esm'], function(cb) {
323329
});
324330

325331
gulp.task('build/rxjs-fake-async.js', ['compile-esm'], function(cb) {
326-
return generateScript('./lib/rxjs/rxjs-fake-async.ts', 'zone-patch-rxjs-fake-async.js', false, cb);
332+
return generateScript(
333+
'./lib/rxjs/rxjs-fake-async.ts', 'zone-patch-rxjs-fake-async.js', false, cb);
327334
});
328335

329336
gulp.task('build/rxjs-fake-async.min.js', ['compile-esm'], function(cb) {
330-
return generateScript('./lib/rxjs/rxjs-fake-async.ts', 'zone-patch-rxjs-fake-async.min.js', true, cb);
337+
return generateScript(
338+
'./lib/rxjs/rxjs-fake-async.ts', 'zone-patch-rxjs-fake-async.min.js', true, cb);
331339
});
332340

333341
gulp.task('build/closure.js', function() {

karma-base.conf.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,39 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
module.exports = function (config) {
9+
module.exports = function(config) {
1010
config.set({
1111
basePath: '',
1212
files: [
13-
'node_modules/systemjs/dist/system-polyfills.js',
14-
'node_modules/systemjs/dist/system.src.js',
13+
'node_modules/systemjs/dist/system-polyfills.js', 'node_modules/systemjs/dist/system.src.js',
1514
'node_modules/whatwg-fetch/fetch.js',
16-
{pattern: 'node_modules/rxjs/**/**/*.js', included: false, watched: false },
17-
{pattern: 'node_modules/rxjs/**/**/*.js.map', included: false, watched: false },
18-
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
19-
{pattern: 'node_modules/es6-promise/**/*.js', included: false, watched: false },
20-
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
15+
{pattern: 'node_modules/rxjs/**/**/*.js', included: false, watched: false},
16+
{pattern: 'node_modules/rxjs/**/**/*.js.map', included: false, watched: false},
17+
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
18+
{pattern: 'node_modules/es6-promise/**/*.js', included: false, watched: false},
19+
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false},
2120
{pattern: 'test/assets/**/*.*', watched: true, served: true, included: false},
2221
{pattern: 'build/**/*.js.map', watched: true, served: true, included: false},
2322
{pattern: 'build/**/*.js', watched: true, served: true, included: false}
2423
],
2524

2625
plugins: [
27-
require('karma-chrome-launcher'),
28-
require('karma-firefox-launcher'),
26+
require('karma-chrome-launcher'), require('karma-firefox-launcher'),
2927
require('karma-sourcemap-loader')
3028
],
3129

32-
preprocessors: {
33-
'**/*.js': ['sourcemap']
34-
},
30+
preprocessors: {'**/*.js': ['sourcemap']},
3531

36-
exclude: [
37-
'test/microtasks.spec.ts'
38-
],
32+
exclude: ['test/microtasks.spec.ts'],
3933

4034
reporters: ['progress'],
4135

42-
//port: 9876,
36+
// port: 9876,
4337
colors: true,
4438

4539
logLevel: config.LOG_INFO,
4640

47-
browsers: ['Firefox'],
41+
browsers: ['Chrome'],
4842

4943
captureTimeout: 60000,
5044

karma-dist-mocha.conf.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11

2-
module.exports = function (config) {
2+
module.exports = function(config) {
33
require('./karma-dist.conf.js')(config);
4-
4+
for (let i = 0; i < config.files.length; i++) {
5+
if (config.files[i] === 'dist/zone-testing.js') {
6+
config.files.splice(i, 1);
7+
break;
8+
}
9+
}
10+
config.files.push('dist/long-stack-trace-zone.js');
11+
config.files.push('dist/proxy.js');
12+
config.files.push('dist/sync-test.js');
13+
config.files.push('dist/async-test.js');
14+
config.files.push('dist/fake-async-test.js');
15+
config.files.push('dist/zone-patch-promise-test.js');
16+
config.files.push('dist/mocha-patch.js');
517
config.plugins.push(require('karma-mocha'));
618
config.frameworks.push('mocha');
719
config.client.mocha = {
8-
timeout: 5000 // copied timeout for Jasmine in WebSocket.spec (otherwise Mochas default timeout at 2 sec is to low for the tests)
20+
timeout: 5000 // copied timeout for Jasmine in WebSocket.spec (otherwise Mochas default timeout
21+
// at 2 sec is to low for the tests)
922
};
1023
};

karma-dist.conf.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
module.exports = function (config) {
9+
module.exports = function(config) {
1010
require('./karma-base.conf.js')(config);
1111
config.files.push('build/test/wtf_mock.js');
1212
config.files.push('build/test/test_fake_polyfill.js');
1313
config.files.push('build/test/custom_error.js');
1414
config.files.push('dist/zone.js');
15+
config.files.push('dist/webapis-media-query.js');
1516
config.files.push('dist/zone-patch-user-media.js');
16-
config.files.push('dist/async-test.js');
17-
config.files.push('dist/fake-async-test.js');
18-
config.files.push('dist/long-stack-trace-zone.js');
19-
config.files.push('dist/proxy.js');
20-
config.files.push('dist/sync-test.js');
17+
config.files.push('dist/zone-patch-resize-observer.js');
18+
config.files.push('dist/webapis-notification.js');
2119
config.files.push('dist/task-tracking.js');
2220
config.files.push('dist/wtf.js');
23-
config.files.push('dist/zone-patch-promise-test.js');
21+
config.files.push('dist/zone-testing.js');
2422
config.files.push('build/test/main.js');
2523
};

sauce.conf.js

Lines changed: 32 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,26 @@
11
// Sauce configuration
22

3-
module.exports = function (config, ignoredLaunchers) {
3+
module.exports = function(config, ignoredLaunchers) {
44
// The WS server is not available with Sauce
55
config.files.unshift('test/saucelabs.js');
66

77
var basicLaunchers = {
8-
'SL_CHROME': {
9-
base: 'SauceLabs',
10-
browserName: 'chrome',
11-
version: '48'
12-
},
13-
'SL_CHROME_60': {
14-
base: 'SauceLabs',
15-
browserName: 'chrome',
16-
version: '60'
17-
},
18-
'SL_FIREFOX': {
19-
base: 'SauceLabs',
20-
browserName: 'firefox',
21-
version: '52'
22-
},
23-
'SL_FIREFOX_54': {
24-
base: 'SauceLabs',
25-
browserName: 'firefox',
26-
version: '54'
27-
},
8+
'SL_CHROME': {base: 'SauceLabs', browserName: 'chrome', version: '48'},
9+
'SL_CHROME_65': {base: 'SauceLabs', browserName: 'chrome', version: '65'},
10+
'SL_FIREFOX': {base: 'SauceLabs', browserName: 'firefox', version: '52'},
11+
'SL_FIREFOX_59': {base: 'SauceLabs', browserName: 'firefox', version: '59'},
2812
/*'SL_SAFARI7': {
2913
base: 'SauceLabs',
3014
browserName: 'safari',
3115
platform: 'OS X 10.9',
3216
version: '7.0'
3317
},*/
34-
'SL_SAFARI8': {
35-
base: 'SauceLabs',
36-
browserName: 'safari',
37-
platform: 'OS X 10.10',
38-
version: '8.0'
39-
},
40-
'SL_SAFARI9': {
41-
base: 'SauceLabs',
42-
browserName: 'safari',
43-
platform: 'OS X 10.11',
44-
version: '9.0'
45-
},
46-
'SL_SAFARI10': {
47-
base: 'SauceLabs',
48-
browserName: 'safari',
49-
platform: 'OS X 10.11',
50-
version: '10.0'
51-
},
18+
'SL_SAFARI8':
19+
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.10', version: '8.0'},
20+
'SL_SAFARI9':
21+
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '9.0'},
22+
'SL_SAFARI10':
23+
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '10.0'},
5224
/*
5325
no longer supported in SauceLabs
5426
'SL_IOS7': {
@@ -57,24 +29,15 @@ module.exports = function (config, ignoredLaunchers) {
5729
platform: 'OS X 10.10',
5830
version: '7.1'
5931
},*/
60-
'SL_IOS8': {
32+
/*'SL_IOS8': {
6133
base: 'SauceLabs',
6234
browserName: 'iphone',
6335
platform: 'OS X 10.10',
6436
version: '8.4'
65-
},
66-
'SL_IOS9': {
67-
base: 'SauceLabs',
68-
browserName: 'iphone',
69-
platform: 'OS X 10.10',
70-
version: '9.3'
71-
},
72-
'SL_IOS10': {
73-
base: 'SauceLabs',
74-
browserName: 'iphone',
75-
platform: 'OS X 10.10',
76-
version: '10.2'
77-
},
37+
},*/
38+
'SL_IOS9': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '9.3'},
39+
'SL_IOS10': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '10.2'},
40+
'SL_IOS11': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '11.2'},
7841
'SL_IE9': {
7942
base: 'SauceLabs',
8043
browserName: 'internet explorer',
@@ -125,24 +88,9 @@ module.exports = function (config, ignoredLaunchers) {
12588
platform: 'Linux',
12689
version: '4.3'
12790
},*/
128-
'SL_ANDROID4.4': {
129-
base: 'SauceLabs',
130-
browserName: 'android',
131-
platform: 'Linux',
132-
version: '4.4'
133-
},
134-
'SL_ANDROID5.1': {
135-
base: 'SauceLabs',
136-
browserName: 'android',
137-
platform: 'Linux',
138-
version: '5.1'
139-
},
140-
'SL_ANDROID6.0': {
141-
base: 'SauceLabs',
142-
browserName: 'android',
143-
platform: 'Linux',
144-
version: '6.0'
145-
},
91+
'SL_ANDROID4.4': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.4'},
92+
'SL_ANDROID5.1': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '5.1'},
93+
'SL_ANDROID6.0': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '6.0'},
14694
'SL_ANDROID7.1': {
14795
base: 'SauceLabs',
14896
browserName: 'Chrome',
@@ -158,7 +106,11 @@ module.exports = function (config, ignoredLaunchers) {
158106
customLaunchers = basicLaunchers;
159107
} else {
160108
Object.keys(basicLaunchers).forEach(function(key) {
161-
if (ignoredLaunchers.filter(function(ignore) {return ignore === key;}).length === 0) {
109+
if (ignoredLaunchers
110+
.filter(function(ignore) {
111+
return ignore === key;
112+
})
113+
.length === 0) {
162114
customLaunchers[key] = basicLaunchers[key];
163115
}
164116
});
@@ -173,11 +125,11 @@ module.exports = function (config, ignoredLaunchers) {
173125
startConnect: false,
174126
recordVideo: false,
175127
recordScreenshots: false,
176-
options: {
177-
'selenium-version': '2.53.0',
178-
'command-timeout': 600,
179-
'idle-timeout': 600,
180-
'max-duration': 5400
128+
options: {
129+
'selenium-version': '2.53.0',
130+
'command-timeout': 600,
131+
'idle-timeout': 600,
132+
'max-duration': 5400
181133
}
182134
},
183135

@@ -189,13 +141,12 @@ module.exports = function (config, ignoredLaunchers) {
189141

190142
singleRun: true,
191143

192-
plugins: [
193-
'karma-*'
194-
]
144+
plugins: ['karma-*']
195145
});
196146

197147
if (process.env.TRAVIS) {
198-
config.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
148+
config.sauceLabs.build =
149+
'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
199150
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
200151

201152
process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join('');

test/browser-zone-setup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ if (typeof window !== 'undefined') {
1111
import '../lib/common/to-string';
1212
import '../lib/browser/browser';
1313
import '../lib/browser/webapis-user-media';
14+
import '../lib/browser/webapis-media-query';
1415
import '../lib/zone-spec/async-test';
1516
import '../lib/zone-spec/fake-async-test';
1617
import '../lib/zone-spec/long-stack-trace';
@@ -21,3 +22,4 @@ import '../lib/zone-spec/wtf';
2122
import '../lib/extra/cordova';
2223
import '../lib/testing/promise-testing';
2324
import '../lib/browser/webapis-resize-observer';
25+
import '../lib/rxjs/rxjs-fake-async';

test/browser/MediaQuery.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import '../../lib/browser/webapis-media-query';
10-
119
import {zoneSymbol} from '../../lib/common/utils';
1210
import {ifEnvSupports} from '../test-util';
1311
declare const global: any;

test/browser/Notification.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import '../../lib/browser/webapis-notification';
10-
119
import {zoneSymbol} from '../../lib/common/utils';
1210
import {ifEnvSupports} from '../test-util';
1311
declare const window: any;

0 commit comments

Comments
 (0)