Skip to content

Commit

Permalink
fix(build): fix e2e, demos, and karma tests to use new angular module…
Browse files Browse the repository at this point in the history
… setup.
  • Loading branch information
jthoms1 committed May 12, 2016
1 parent 4b36c34 commit 4c19d15
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 48 deletions.
8 changes: 3 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,9 @@ gulp.task('copy.libs', function() {
'node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.src.js', //npm2
'node_modules/es6-module-loader/dist/es6-module-loader.src.js', //npm3
'node_modules/systemjs/dist/system.src.js',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/angular2/bundles/angular2.dev.js',
'node_modules/angular2/bundles/router.dev.js',
'node_modules/angular2/bundles/http.dev.js',
'node_modules/rxjs/bundles/Rx.js'
'node_modules/rxjs/bundles/Rx.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js'
])
.pipe(gulp.dest('dist/js'));

Expand Down
42 changes: 9 additions & 33 deletions scripts/e2e/e2e.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,55 +38,31 @@

<script src="../../../js/es6-shim.min.js"></script>
<script src="../../../js/es6-module-loader.src.js"></script>
<script src="../../../js/Reflect.js"></script>
<script src="../../../js/zone.js"></script>
<script src="../../../js/system.src.js"></script>
<script>
System.config({
map: {
'@angular': '/node_modules/@angular',
'@angular/core': '/node_modules/@angular/core/core.umd.js',
'@angular/compiler': '/node_modules/@angular/compiler/compiler.umd.js',
'@angular/common': '/node_modules/@angular/common/common.umd.js',
'@angular/http': '/node_modules/@angular/http/http.umd.js',
'@angular/platform-browser': '/node_modules/@angular/platform-browser/platform-browser.umd.js',
'@angular/platform-browser-dynamic': '/node_modules/@angular/platform-browser-dynamic/platform-browser-dynamic.umd.js',
'@angular/router': '/node_modules/@angular/router/router.umd.js',
'ionic-angular': '/ionic'
},
packages: {
'ionic-angular': {
main: 'index'
},
'@angular/core': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/http': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/router': {
main: 'index.js',
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
}
}
});
</script>
<script src="../../../js/angular2-polyfills.js"></script>
<script src="../../../js/angular2.dev.js"></script>
<script src="../../../js/router.dev.js"></script>
<script src="../../../js/http.dev.js"></script>
<script src="../../../bundles/ionic.system.js"></script>
<script src="../../../js/Rx.js"></script>

Expand Down
10 changes: 5 additions & 5 deletions scripts/karma/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ module.exports = function(config) {
frameworks: ['jasmine'],

files: [
'node_modules/es6-shim/es6-shim.min.js',

'node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.js', //npm2
'node_modules/es6-module-loader/dist/es6-module-loader.js', //npm3
'node_modules/reflect-metadata/Reflect.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/systemjs/dist/system.js',
'scripts/karma/system.config.js',
'node_modules/angular2/bundles/angular2-polyfills.min.js',
'node_modules/angular2/bundles/angular2.min.js',
'node_modules/angular2/bundles/router.min.js',
'node_modules/angular2/bundles/http.min.js',
'node_modules/rxjs/bundles/Rx.min.js',
'dist/bundles/ionic.system.js',
//'node_modules/angular2/bundles/test_lib.js',
{ pattern: 'node_modules/@angular/**/*.js', included: false},
{ pattern: 'dist/tests/**/*.spec.js', included: false },
'scripts/karma/test-main.js'
],
Expand Down
55 changes: 52 additions & 3 deletions scripts/karma/system.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
System.config({
baseURL: '/base',
map: {
'angular2': '/base/angular2',
'ionic-angular': '/base/ionic'
'ionic-angular': 'ionic',
'@angular': 'node_modules/@angular',
},
packages: {
'ionic-angular': {
main: 'index'
},
'rxjs': {
defaultExtension: 'js'
},
'@angular/core': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'index.js',
defaultExtension: 'js'
},
// remove after all tests imports are fixed
'@angular/facade': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/router': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/router-deprecated': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/http': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/upgrade': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-server': {
main: 'index.js',
defaultExtension: 'js'
}
}
});
});
9 changes: 7 additions & 2 deletions scripts/karma/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 50;
// we will call `__karma__.start()` later, once all the specs are loaded.
__karma__.loaded = function() {};

System.import('angular2/src/platform/browser/browser_adapter').then(function(browser_adapter) {
browser_adapter.BrowserDomAdapter.makeCurrent();
System.import('@angular/core/testing').then(function(coreTesting) {
return System.import('@angular/platform-browser-dynamic/testing').then(function(browserTesting) {
coreTesting.setBaseTestProviders(
browserTesting.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
browserTesting.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
);
});
}).then(function() {
return Promise.all(
Object.keys(window.__karma__.files) // All files served by Karma.
Expand Down

0 comments on commit 4c19d15

Please sign in to comment.