mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(tests): fix karma tests
This commit is contained in:
@ -224,8 +224,7 @@ function bundle(args) {
|
|||||||
|
|
||||||
gulp.task('tests', function() {
|
gulp.task('tests', function() {
|
||||||
return gulp.src('ionic/**/test/**/*.spec.ts')
|
return gulp.src('ionic/**/test/**/*.spec.ts')
|
||||||
.pipe(tsc(tscOptions, undefined, tscReporter))
|
.pipe(tsc(tscOptionsNoTypeCheck, undefined, tscReporter))
|
||||||
.pipe(babel(getBabelOptions('dist/tests')))
|
|
||||||
.pipe(rename(function(file) {
|
.pipe(rename(function(file) {
|
||||||
var regex = new RegExp(path.sep + 'test(' + path.sep + '|$)');
|
var regex = new RegExp(path.sep + 'test(' + path.sep + '|$)');
|
||||||
file.dirname = file.dirname.replace(regex, path.sep);
|
file.dirname = file.dirname.replace(regex, path.sep);
|
||||||
@ -495,7 +494,6 @@ function buildDemoBundle(opts, done) {
|
|||||||
var glob = require('glob');
|
var glob = require('glob');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var _ = require('lodash');
|
|
||||||
|
|
||||||
var fp = 'dist/demos/'+opts.demo+'/index.js';
|
var fp = 'dist/demos/'+opts.demo+'/index.js';
|
||||||
if (opts.demo == 'api') {
|
if (opts.demo == 'api') {
|
||||||
|
@ -7,19 +7,24 @@ module.exports = function(config) {
|
|||||||
|
|
||||||
frameworks: ['jasmine'],
|
frameworks: ['jasmine'],
|
||||||
|
|
||||||
files: buildConfig.scripts.concat([
|
files: [
|
||||||
'node_modules/angular2/bundles/test_lib.js',
|
'node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.js',
|
||||||
'dist/tests/**/*.spec.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'
|
'scripts/karma/test-main.js'
|
||||||
]),
|
],
|
||||||
|
|
||||||
exclude: buildConfig.src.e2e,
|
exclude: ['ionic/components/*/test/*/**/*'],
|
||||||
|
|
||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
|
|
||||||
preprocessors: {
|
|
||||||
},
|
|
||||||
|
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
port: 9876
|
port: 9876
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 50;
|
|||||||
// we will call `__karma__.start()` later, once all the specs are loaded.
|
// we will call `__karma__.start()` later, once all the specs are loaded.
|
||||||
__karma__.loaded = function() {};
|
__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();
|
browser_adapter.BrowserDomAdapter.makeCurrent();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
@ -33,12 +33,4 @@ function onlySpecFiles(path) {
|
|||||||
}
|
}
|
||||||
function file2moduleName(filePath) {
|
function file2moduleName(filePath) {
|
||||||
return filePath.replace(/\\/g, '/')
|
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$/, '');
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user