mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
change karma configuration for RC1
This commit is contained in:
@@ -3,28 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'ng2-translate': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register'
|
||||
}
|
||||
},
|
||||
map: {
|
||||
'ng2-translate': '/base/node_modules/ng2-translate/bundles'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -32,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -63,12 +86,3 @@ function resolveTestFiles() {
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,81 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
config.set({
|
||||
|
||||
basePath: '.',
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/bundles/ng2-translate.js', included: true, watched: false},
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/bundles/ng2-translate.js', included: true, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
port: 9876,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
colors: true,
|
||||
colors: true,
|
||||
|
||||
autoWatch: true,
|
||||
autoWatch: true,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['Chrome'],
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
};
|
||||
|
@@ -3,25 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
},
|
||||
map: {
|
||||
'rxjs': '/base/node_modules/rxjs'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -29,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -60,12 +86,3 @@ function resolveTestFiles() {
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,91 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
port: 9876,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
colors: true,
|
||||
colors: true,
|
||||
|
||||
autoWatch: true,
|
||||
autoWatch: true,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['Chrome'],
|
||||
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
config.set(configuration)
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
config.set(configuration)
|
||||
};
|
||||
|
@@ -3,29 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'ng2-alfresco-core': { defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' },
|
||||
'ng2-translate': { defaultExtension: 'js' }
|
||||
},
|
||||
map: {
|
||||
'ng2-alfresco-core': '/base/node_modules/ng2-alfresco-core',
|
||||
'rxjs': '/base/node_modules/rxjs',
|
||||
'ng2-translate': '/base/node_modules/ng2-translate'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -33,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -64,12 +86,3 @@ function resolveTestFiles() {
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,98 +1,97 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, watched: false},
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, watched: false},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'node_modules/**/*spec.js'
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'node_modules/**/*spec.js'
|
||||
],
|
||||
port: 9876,
|
||||
|
||||
port: 9876,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
colors: true,
|
||||
|
||||
colors: true,
|
||||
autoWatch: true,
|
||||
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
|
||||
browsers: ['Chrome'],
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
|
||||
config.set(configuration)
|
||||
config.set(configuration)
|
||||
};
|
||||
|
@@ -3,35 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'ng2-alfresco-core/dist': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'ng2-translate': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'rxjs': {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
},
|
||||
map: {
|
||||
'ng2-alfresco-core/dist': '/base/node_modules/ng2-alfresco-core/dist',
|
||||
'rxjs': '/base/node_modules/rxjs',
|
||||
'ng2-translate' : '/base/node_modules/ng2-translate'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -39,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -70,12 +86,3 @@ function resolveTestFiles() {
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,94 +1,94 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true },
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
port: 9876,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
colors: true,
|
||||
colors: true,
|
||||
|
||||
autoWatch: true,
|
||||
autoWatch: true,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['Chrome'],
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
|
||||
config.set(configuration)
|
||||
config.set(configuration)
|
||||
};
|
||||
|
@@ -3,27 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'ng2-alfresco-core/dist': {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
},
|
||||
map: {
|
||||
'ng2-alfresco-core/dist': '/base/node_modules/ng2-alfresco-core/dist'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -31,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -62,12 +86,3 @@ function resolveTestFiles() {
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,93 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
port: 9876,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
colors: true,
|
||||
colors: true,
|
||||
|
||||
autoWatch: true,
|
||||
autoWatch: true,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['Chrome'],
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
|
||||
config.set(configuration)
|
||||
config.set(configuration)
|
||||
};
|
||||
|
@@ -3,35 +3,50 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
},
|
||||
'ng2-alfresco-core/dist': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'ng2-translate': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'rxjs': {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
},
|
||||
map: {
|
||||
'ng2-alfresco-core/dist': '/base/node_modules/ng2-alfresco-core/dist',
|
||||
'rxjs': '/base/node_modules/rxjs',
|
||||
'ng2-translate' : '/base/node_modules/ng2-translate'
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
@@ -39,14 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
console.log(error);
|
||||
__karma__.error(error.stack || error);
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
@@ -65,15 +82,7 @@ function resolveTestFiles() {
|
||||
.filter(onlySpecFiles)
|
||||
.map(function(moduleName) {
|
||||
// loads all spec files via their global module names (e.g.
|
||||
// 'base/dist/vg-player/vg-player.spec')
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
}
|
||||
|
@@ -1,94 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (config) {
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
var configuration = {
|
||||
basePath: '.',
|
||||
|
||||
frameworks: ['jasmine-ajax', 'jasmine'],
|
||||
frameworks: ['jasmine-ajax', 'jasmine'],
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, served: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
// paths loaded via module imports
|
||||
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
|
||||
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
|
||||
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
// paths to support debugging with source maps in dev tools
|
||||
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||
],
|
||||
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
// proxied base paths
|
||||
proxies: {
|
||||
// required for component assets fetched by Angular's compiler
|
||||
'/src/': '/base/src/'
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
port: 9876,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_DEBUG,
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_DEBUG,
|
||||
|
||||
colors: true,
|
||||
colors: true,
|
||||
|
||||
autoWatch: true,
|
||||
autoWatch: true,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
browsers: ['Chrome'],
|
||||
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-jasmine-ajax',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-coverage',
|
||||
'karma-jasmine-ajax',
|
||||
'karma-chrome-launcher',
|
||||
'karma-mocha-reporter',
|
||||
'karma-jasmine-html-reporter'
|
||||
],
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
// Source files that you wanna generate coverage for.
|
||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||
preprocessors: {
|
||||
'dist/**/!(*spec).js': ['coverage']
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
coverageReporter: {
|
||||
dir: 'coverage/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
|
||||
config.set(configuration)
|
||||
config.set(configuration)
|
||||
};
|
||||
|
@@ -3,65 +3,86 @@ Error.stackTraceLimit = Infinity;
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||
|
||||
// // Cancel Karma's synchronous start,
|
||||
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||
__karma__.loaded = function() {};
|
||||
|
||||
System.config({
|
||||
packages: {
|
||||
'base/dist': {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
}
|
||||
}
|
||||
var map = {
|
||||
'app': 'base/dist',
|
||||
'rxjs': 'base/node_modules/rxjs',
|
||||
'@angular': 'base/node_modules/@angular'
|
||||
};
|
||||
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' }
|
||||
};
|
||||
|
||||
var packageNames = [
|
||||
'@angular/common',
|
||||
'@angular/compiler',
|
||||
'@angular/core',
|
||||
'@angular/http',
|
||||
'@angular/platform-browser',
|
||||
'@angular/platform-browser-dynamic',
|
||||
'@angular/router',
|
||||
'@angular/router-deprecated',
|
||||
'@angular/testing',
|
||||
'@angular/upgrade',
|
||||
];
|
||||
|
||||
packageNames.forEach(function(pkgName) {
|
||||
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
});
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
function() {
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
__karma__.error(error.stack || error);
|
||||
}
|
||||
);
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
};
|
||||
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
function() {
|
||||
__karma__.start();
|
||||
},
|
||||
function(error) {
|
||||
if(typeof __karma__.error == 'fucntion') {
|
||||
__karma__.error(error.stack || error);
|
||||
}else{
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
function createPathRecords(pathsMapping, appPath) {
|
||||
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||
// './vg-player/vg-player':
|
||||
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
var pathParts = appPath.split('/');
|
||||
var moduleName = './' + pathParts.slice(Math.max(pathParts.length - 2, 1)).join('/');
|
||||
moduleName = moduleName.replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
}
|
||||
|
||||
function onlyAppFiles(filePath) {
|
||||
return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath);
|
||||
return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath);
|
||||
}
|
||||
|
||||
function onlySpecFiles(path) {
|
||||
return /\.spec\.js$/.test(path);
|
||||
return /\.spec\.js$/.test(path);
|
||||
}
|
||||
|
||||
function resolveTestFiles() {
|
||||
return Object.keys(window.__karma__.files) // All files served by Karma.
|
||||
.filter(onlySpecFiles)
|
||||
.map(function(moduleName) {
|
||||
// loads all spec files via their global module names (e.g.
|
||||
// 'base/dist/vg-player/vg-player.spec')
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
||||
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||
var location = appPath.indexOf(basePathWhereToStart);
|
||||
if (location > -1) {
|
||||
return appPath.substring(basePathWhereToStart.length + 1);
|
||||
} else {
|
||||
return appPath;
|
||||
}
|
||||
return Object.keys(window.__karma__.files) // All files served by Karma.
|
||||
.filter(onlySpecFiles)
|
||||
.map(function(moduleName) {
|
||||
// loads all spec files via their global module names (e.g.
|
||||
// 'base/dist/vg-player/vg-player.spec')
|
||||
return System.import(moduleName);
|
||||
});
|
||||
}
|
||||
|
@@ -9,14 +9,12 @@ module.exports = function (config) {
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
|
||||
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
|
||||
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
|
Reference in New Issue
Block a user