From cc97919bcc180d78515b5000454187f79ac90258 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Wed, 16 Dec 2015 18:20:50 -0600 Subject: [PATCH] fix(tests): fix karma tests --- gulpfile.js | 4 +--- scripts/karma/karma.conf.js | 21 +++++++++++++-------- scripts/karma/test-main.js | 10 +--------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index fc086944b5..8e99efa230 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -224,8 +224,7 @@ function bundle(args) { gulp.task('tests', function() { return gulp.src('ionic/**/test/**/*.spec.ts') - .pipe(tsc(tscOptions, undefined, tscReporter)) - .pipe(babel(getBabelOptions('dist/tests'))) + .pipe(tsc(tscOptionsNoTypeCheck, undefined, tscReporter)) .pipe(rename(function(file) { var regex = new RegExp(path.sep + 'test(' + path.sep + '|$)'); file.dirname = file.dirname.replace(regex, path.sep); @@ -495,7 +494,6 @@ function buildDemoBundle(opts, done) { var glob = require('glob'); var webpack = require('webpack'); var path = require('path'); - var _ = require('lodash'); var fp = 'dist/demos/'+opts.demo+'/index.js'; if (opts.demo == 'api') { diff --git a/scripts/karma/karma.conf.js b/scripts/karma/karma.conf.js index 5a81f6a1ab..2a90c1563d 100644 --- a/scripts/karma/karma.conf.js +++ b/scripts/karma/karma.conf.js @@ -7,19 +7,24 @@ module.exports = function(config) { frameworks: ['jasmine'], - files: buildConfig.scripts.concat([ - 'node_modules/angular2/bundles/test_lib.js', - 'dist/tests/**/*.spec.js', + files: [ + 'node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.js', + 'node_modules/systemjs/dist/system.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: 'dist/tests/**/*.spec.js', included: false }, 'scripts/karma/test-main.js' - ]), + ], - exclude: buildConfig.src.e2e, + exclude: ['ionic/components/*/test/*/**/*'], logLevel: 'warn', - preprocessors: { - }, - browsers: ['Chrome'], port: 9876 }); diff --git a/scripts/karma/test-main.js b/scripts/karma/test-main.js index de357b69bb..85a3701cfd 100644 --- a/scripts/karma/test-main.js +++ b/scripts/karma/test-main.js @@ -4,7 +4,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 50; // we will call `__karma__.start()` later, once all the specs are loaded. __karma__.loaded = function() {}; -System.import('angular2/src/core/dom/browser_adapter').then(function(browser_adapter) { +System.import('angular2/src/platform/browser/browser_adapter').then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); }).then(function() { return Promise.all( @@ -33,12 +33,4 @@ function onlySpecFiles(path) { } function file2moduleName(filePath) { return filePath.replace(/\\/g, '/') - .replace(/^.*?base\//, '') - // module name should be relative to `modules` and `tools` folder - // .replace(/.*\/modules\//, '') - // .replace(/.*\/tools\//, '') - // module name should not include `lib`, `web` folders - // module name should not have a suffix - // .split('.').pop().join(''); - .replace(/\.js$/, ''); }