Last active
June 28, 2017 06:09
-
-
Save ArtemGovorov/2d5a6535316afa7ff12e0295d2c2f7d5 to your computer and use it in GitHub Desktop.
Wallaby.js config for ng-cli generated project. The config file needs to be in the project root. Works faster with Electron runner: https://wallabyjs.com/docs/integration/electron.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (wallaby) { | |
const compilerOptions = require('./src/tsconfig.json').compilerOptions; | |
compilerOptions.noEmitOnError = false; | |
return { | |
files: [ | |
{pattern: 'node_modules/es6-shim/es6-shim.js', instrument: false}, | |
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', instrument: false}, | |
{pattern: 'node_modules/reflect-metadata/Reflect.js', instrument: false}, | |
{pattern: 'node_modules/systemjs/dist/system.js', instrument: false}, | |
{pattern: 'node_modules/rxjs/bundles/Rx.js', instrument: false}, | |
{pattern: 'node_modules/zone.js/dist/zone.js', instrument: false}, | |
{pattern: 'node_modules/zone.js/dist/async-test.js', instrument: false}, | |
{pattern: 'src/system-config.ts', instrument: false}, | |
{pattern: 'src/app/**/*.ts', load: false}, | |
{pattern: 'src/app/**/*.html', load: false}, | |
{pattern: 'src/app/**/*.css', load: false}, | |
{pattern: 'src/app/**/*.spec.ts', ignore: true} | |
], | |
tests: [{pattern: 'src/app/**/*.spec.ts', load: false}], | |
preprocessors: { | |
// see https://github.com/wallabyjs/public/issues/632#issuecomment-224205605 | |
'src/system-config.ts': file => file.content | |
.replace(/vendor/g, 'node_modules') | |
.replace(/app\//g, 'src\/app\/') | |
}, | |
compilers: { | |
'**/*.ts': wallaby.compilers.typeScript(compilerOptions) | |
}, | |
middleware: function (app, express) { | |
app.use('/node_modules', express.static(require('path').join(__dirname, 'node_modules'))); | |
}, | |
setup: function (wallaby) { | |
wallaby.delayStart(); | |
System.config({ | |
defaultJSExtensions: true | |
}); | |
var promises = []; | |
Promise.all([System.import('@angular/core/testing'), System.import('@angular/platform-browser-dynamic/testing')]) | |
.then(function (results) { | |
var testing = results[0]; | |
var browser = results[1]; | |
testing.setBaseTestProviders( | |
browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, | |
browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS | |
); | |
for (var i = 0, len = wallaby.tests.length; i < len; i++) { | |
promises.push(System['import'](wallaby.tests[i].replace(/\.js$/, ''))); | |
} | |
}) | |
.then(function () { | |
return Promise.all(promises); | |
}) | |
.then(function () { | |
wallaby.start(); | |
}) | |
.catch(function (e) { | |
setTimeout(function () { | |
throw e; | |
}, 0); | |
}); | |
}, | |
debug: true | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ahh, guessing this config is for the version of angular2-cli before it switched over to webpack builds. Any chance you have a config for angular2-cli + webpack?