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

Commit

Permalink
fix(test): karma-dist should test bundle under dist
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion committed Mar 16, 2018
1 parent c8c5990 commit fed65b1
Show file tree
Hide file tree
Showing 15 changed files with 331 additions and 347 deletions.
24 changes: 16 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ function generateScript(inFile, outFile, minify, callback) {
'rxjs/Observable': 'Rx',
'rxjs/Subscriber': 'Rx',
'rxjs/Subscription': 'Rx',
'rxjs/Scheduler': 'Rx',
'rxjs/scheduler/asap': 'Rx.Scheduler',
'rxjs/scheduler/async': 'Rx.Scheduler',
'rxjs/symbol/rxSubscriber': 'Rx.Symbol'
}
},
Expand Down Expand Up @@ -221,19 +223,23 @@ gulp.task('build/zone-patch-socket-io.min.js', ['compile-esm'], function(cb) {
});

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

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

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

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

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

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

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

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

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

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

gulp.task('build/closure.js', function() {
Expand Down
30 changes: 12 additions & 18 deletions karma-base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,39 @@
* found in the LICENSE file at https://angular.io/license
*/

module.exports = function (config) {
module.exports = function(config) {
config.set({
basePath: '',
files: [
'node_modules/systemjs/dist/system-polyfills.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/systemjs/dist/system-polyfills.js', 'node_modules/systemjs/dist/system.src.js',
'node_modules/whatwg-fetch/fetch.js',
{pattern: 'node_modules/rxjs/**/**/*.js', included: false, watched: false },
{pattern: 'node_modules/rxjs/**/**/*.js.map', included: false, watched: false },
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
{pattern: 'node_modules/es6-promise/**/*.js', included: false, watched: false },
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
{pattern: 'node_modules/rxjs/**/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/**/*.js.map', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
{pattern: 'node_modules/es6-promise/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false},
{pattern: 'test/assets/**/*.*', watched: true, served: true, included: false},
{pattern: 'build/**/*.js.map', watched: true, served: true, included: false},
{pattern: 'build/**/*.js', watched: true, served: true, included: false}
],

plugins: [
require('karma-chrome-launcher'),
require('karma-firefox-launcher'),
require('karma-chrome-launcher'), require('karma-firefox-launcher'),
require('karma-sourcemap-loader')
],

preprocessors: {
'**/*.js': ['sourcemap']
},
preprocessors: {'**/*.js': ['sourcemap']},

exclude: [
'test/microtasks.spec.ts'
],
exclude: ['test/microtasks.spec.ts'],

reporters: ['progress'],

//port: 9876,
// port: 9876,
colors: true,

logLevel: config.LOG_INFO,

browsers: ['Firefox'],
browsers: ['Chrome'],

captureTimeout: 60000,

Expand Down
7 changes: 5 additions & 2 deletions karma-dist-mocha.conf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

module.exports = function (config) {
module.exports = function(config) {
require('./karma-dist.conf.js')(config);

config.files.push('dist/mocha-patch.js');
config.files.push('build/test/test-env-setup-mocha.js');
config.plugins.push(require('karma-mocha'));
config.frameworks.push('mocha');
config.client.mocha = {
timeout: 5000 // copied timeout for Jasmine in WebSocket.spec (otherwise Mochas default timeout at 2 sec is to low for the tests)
timeout: 5000 // copied timeout for Jasmine in WebSocket.spec (otherwise Mochas default timeout
// at 2 sec is to low for the tests)
};
};
12 changes: 5 additions & 7 deletions karma-dist.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
* found in the LICENSE file at https://angular.io/license
*/

module.exports = function (config) {
module.exports = function(config) {
require('./karma-base.conf.js')(config);
config.files.push('build/test/wtf_mock.js');
config.files.push('build/test/test_fake_polyfill.js');
config.files.push('build/test/custom_error.js');
config.files.push('dist/zone.js');
config.files.push('dist/webapis-media-query.js');
config.files.push('dist/zone-patch-user-media.js');
config.files.push('dist/async-test.js');
config.files.push('dist/fake-async-test.js');
config.files.push('dist/long-stack-trace-zone.js');
config.files.push('dist/proxy.js');
config.files.push('dist/sync-test.js');
config.files.push('dist/zone-patch-resize-observer.js');
config.files.push('dist/webapis-notification.js');
config.files.push('dist/task-tracking.js');
config.files.push('dist/wtf.js');
config.files.push('dist/zone-patch-promise-test.js');
config.files.push('dist/zone-testing.js');
config.files.push('build/test/main.js');
};
112 changes: 31 additions & 81 deletions sauce.conf.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,26 @@
// Sauce configuration

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

var basicLaunchers = {
'SL_CHROME': {
base: 'SauceLabs',
browserName: 'chrome',
version: '48'
},
'SL_CHROME_60': {
base: 'SauceLabs',
browserName: 'chrome',
version: '60'
},
'SL_FIREFOX': {
base: 'SauceLabs',
browserName: 'firefox',
version: '52'
},
'SL_FIREFOX_54': {
base: 'SauceLabs',
browserName: 'firefox',
version: '54'
},
'SL_CHROME': {base: 'SauceLabs', browserName: 'chrome', version: '48'},
'SL_CHROME_60': {base: 'SauceLabs', browserName: 'chrome', version: '60'},
'SL_FIREFOX': {base: 'SauceLabs', browserName: 'firefox', version: '52'},
'SL_FIREFOX_54': {base: 'SauceLabs', browserName: 'firefox', version: '54'},
/*'SL_SAFARI7': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.9',
version: '7.0'
},*/
'SL_SAFARI8': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.10',
version: '8.0'
},
'SL_SAFARI9': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '9.0'
},
'SL_SAFARI10': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '10.0'
},
'SL_SAFARI8':
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.10', version: '8.0'},
'SL_SAFARI9':
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '9.0'},
'SL_SAFARI10':
{base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '10.0'},
/*
no longer supported in SauceLabs
'SL_IOS7': {
Expand All @@ -57,24 +29,14 @@ module.exports = function (config, ignoredLaunchers) {
platform: 'OS X 10.10',
version: '7.1'
},*/
'SL_IOS8': {
/*'SL_IOS8': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '8.4'
},
'SL_IOS9': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.3'
},
'SL_IOS10': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '10.2'
},
},*/
'SL_IOS9': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '9.3'},
'SL_IOS10': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '10.2'},
'SL_IE9': {
base: 'SauceLabs',
browserName: 'internet explorer',
Expand Down Expand Up @@ -125,24 +87,9 @@ module.exports = function (config, ignoredLaunchers) {
platform: 'Linux',
version: '4.3'
},*/
'SL_ANDROID4.4': {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
},
'SL_ANDROID5.1': {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '5.1'
},
'SL_ANDROID6.0': {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '6.0'
},
'SL_ANDROID4.4': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.4'},
'SL_ANDROID5.1': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '5.1'},
'SL_ANDROID6.0': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '6.0'},
'SL_ANDROID7.1': {
base: 'SauceLabs',
browserName: 'Chrome',
Expand All @@ -158,7 +105,11 @@ module.exports = function (config, ignoredLaunchers) {
customLaunchers = basicLaunchers;
} else {
Object.keys(basicLaunchers).forEach(function(key) {
if (ignoredLaunchers.filter(function(ignore) {return ignore === key;}).length === 0) {
if (ignoredLaunchers
.filter(function(ignore) {
return ignore === key;
})
.length === 0) {
customLaunchers[key] = basicLaunchers[key];
}
});
Expand All @@ -173,11 +124,11 @@ module.exports = function (config, ignoredLaunchers) {
startConnect: false,
recordVideo: false,
recordScreenshots: false,
options: {
'selenium-version': '2.53.0',
'command-timeout': 600,
'idle-timeout': 600,
'max-duration': 5400
options: {
'selenium-version': '2.53.0',
'command-timeout': 600,
'idle-timeout': 600,
'max-duration': 5400
}
},

Expand All @@ -189,13 +140,12 @@ module.exports = function (config, ignoredLaunchers) {

singleRun: true,

plugins: [
'karma-*'
]
plugins: ['karma-*']
});

if (process.env.TRAVIS) {
config.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
config.sauceLabs.build =
'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;

process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join('');
Expand Down
2 changes: 2 additions & 0 deletions test/browser-zone-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if (typeof window !== 'undefined') {
import '../lib/common/to-string';
import '../lib/browser/browser';
import '../lib/browser/webapis-user-media';
import '../lib/browser/webapis-media-query';
import '../lib/zone-spec/async-test';
import '../lib/zone-spec/fake-async-test';
import '../lib/zone-spec/long-stack-trace';
Expand All @@ -21,3 +22,4 @@ import '../lib/zone-spec/wtf';
import '../lib/extra/cordova';
import '../lib/testing/promise-testing';
import '../lib/browser/webapis-resize-observer';
import '../lib/rxjs/rxjs-fake-async';
2 changes: 0 additions & 2 deletions test/browser/MediaQuery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

import '../../lib/browser/webapis-media-query';

import {zoneSymbol} from '../../lib/common/utils';
import {ifEnvSupports} from '../test-util';
declare const global: any;
Expand Down
2 changes: 0 additions & 2 deletions test/browser/Notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

import '../../lib/browser/webapis-notification';

import {zoneSymbol} from '../../lib/common/utils';
import {ifEnvSupports} from '../test-util';
declare const window: any;
Expand Down
Loading

0 comments on commit fed65b1

Please sign in to comment.