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