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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ module.exports = function (config) {
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
|
||||
files: [
|
||||
// paths loaded by Karma
|
||||
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||
|
@@ -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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -8,13 +8,12 @@ module.exports = function (config) {
|
||||
|
||||
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},
|
||||
{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},
|
||||
|
||||
@@ -54,7 +53,6 @@ module.exports = function (config) {
|
||||
},
|
||||
|
||||
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
|
@@ -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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
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'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -8,16 +8,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/**/*.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: '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},
|
||||
|
||||
|
@@ -3,21 +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': {
|
||||
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' };
|
||||
});
|
||||
|
||||
packages['base/dist'] = {
|
||||
defaultExtension: 'js',
|
||||
format: 'register',
|
||||
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
System.import('angular2/src/platform/browser/browser_adapter')
|
||||
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(
|
||||
@@ -25,15 +54,16 @@ System.import('angular2/src/platform/browser/browser_adapter')
|
||||
__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);
|
||||
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;
|
||||
@@ -56,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;
|
||||
}
|
||||
}
|
||||
|
@@ -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