Commit 335b5fde authored by Ward Bell's avatar Ward Bell

chore: update test configuration

parent 74e20579
...@@ -22,35 +22,55 @@ var allSpecFiles = Object.keys(window.__karma__.files) ...@@ -22,35 +22,55 @@ var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isSpecFile) .filter(isSpecFile)
.filter(isBuiltFile); .filter(isBuiltFile);
//////////////////////////
// Load our SystemJS configuration. // Load our SystemJS configuration.
var packages ={ // map tells the System loader where to look for things
'app': { main: 'main.js', defaultExtension: 'js' }, var map = {
'rxjs': { defaultExtension: 'js' }, 'app': 'app',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' },
}; };
// Add angular packages to SystemJS config var ngPackageNames = [
[ 'common',
'@angular/common', 'compiler',
'@angular/compiler', 'core',
'@angular/core', 'http',
'@angular/http', 'platform-browser',
'@angular/platform-browser', 'platform-browser-dynamic',
'@angular/platform-browser-dynamic', 'router',
'@angular/router', 'router-deprecated',
'@angular/router-deprecated', 'upgrade',
'@angular/upgrade' ];
].forEach(function (name) { packages[name] = {main: 'index.js', defaultExtension: 'js'};});
// Add package entries for angular packages
System.config({ ngPackageNames.forEach(function(pkgName) {
// Bundled (~40 requests): DOESN'T WORK IN KARMA OR WALLABY (YET?)
//packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
// Individual files (~300 requests):
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
baseURL: '/base', baseURL: '/base',
map: { map: map,
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular',
'app': 'app'
},
packages: packages packages: packages
}); }
System.config(config);
//////////////
Promise.all([ Promise.all([
System.import('@angular/core/testing'), System.import('@angular/core/testing'),
......
...@@ -22,7 +22,6 @@ module.exports = function(config) { ...@@ -22,7 +22,6 @@ module.exports = function(config) {
}, },
files: [ files: [
// System.js for module loading // System.js for module loading
'node_modules/systemjs/dist/system-polyfills.js',
'node_modules/systemjs/dist/system.src.js', 'node_modules/systemjs/dist/system.src.js',
// Polyfills // Polyfills
......
// Configuration for the Wallaby Visual Studio Code testing extension // Configuration for the Wallaby Visual Studio Code testing extension
// https://marketplace.visualstudio.com/items?itemName=WallabyJs.wallaby-vscode // https://marketplace.visualstudio.com/items?itemName=WallabyJs.wallaby-vscode
// Note: Wallaby is not open source and costs money // Note: Wallaby is not open source and costs money
module.exports = function () { module.exports = function () {
return { return {
files: [ files: [
// System.js for module loading // System.js for module loading
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', instrument: false},
{pattern: 'node_modules/systemjs/dist/system.js', instrument: false}, {pattern: 'node_modules/systemjs/dist/system.js', instrument: false},
// Polyfills // Polyfills
{pattern: 'node_modules/es6-shim/es6-shim.js', instrument: false}, {pattern: 'node_modules/core-js/client/shim.min.js', instrument: false},
// Reflect, Zone.js, and test shims // Reflect, Zone.js, and test shims
// Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs // Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs
...@@ -34,35 +34,11 @@ module.exports = function () { ...@@ -34,35 +34,11 @@ module.exports = function () {
testFramework: 'jasmine', testFramework: 'jasmine',
debug: true,
bootstrap: function (wallaby) { bootstrap: function (wallaby) {
wallaby.delayStart(); wallaby.delayStart();
systemConfig();
var packages ={
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
};
// Add angular packages to SystemJS config
[
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/router-deprecated',
'@angular/upgrade'
].forEach(function (name) { packages[name] = {main: 'index.js', defaultExtension: 'js'};});
System.config({
map: {
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular',
'app': 'app'
},
packages:packages
});
Promise.all([ Promise.all([
System.import('@angular/core/testing'), System.import('@angular/core/testing'),
...@@ -90,8 +66,61 @@ module.exports = function () { ...@@ -90,8 +66,61 @@ module.exports = function () {
throw e; throw e;
}, 0); }, 0);
}); });
},
debug: true //////////////////////////
// SystemJS configuration.
function systemConfig() {
// map tells the System loader where to look for things
var map = {
'app': 'app',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' },
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Add package entries for angular packages
ngPackageNames.forEach(function(pkgName) {
// Bundled (~40 requests): DOESN'T WORK IN WALLABY OR KARMA (YET?)
// packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
// Individual files (~300 requests):
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
}
System.config(config);
}
//////////////////
}
}; };
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment