Last active
August 28, 2019 14:33
-
-
Save nergal/3adb98bb01dcb79ac21f74809c614ef9 to your computer and use it in GitHub Desktop.
Wallaby configuration for Angular 5 (created from @angular/cli)
This file contains hidden or 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
var wallabyWebpack = require('wallaby-webpack'); | |
var webpackPostprocessor = wallabyWebpack({ | |
entryPatterns: [ | |
'wallaby.spec-bundle.js', | |
'src/**/*spec.js' | |
], | |
module: { | |
loaders: [ | |
{ test: /\.css$/, loader: 'raw-loader' }, | |
{ test: /\.html$/, loader: 'raw-loader' }, | |
{ test: /\.ts$/, loader: '@ngtools/webpack', include: /node_modules/, query: { tsConfigPath: 'tsconfig.json' } }, | |
{ test: /\.js$/, loader: 'angular2-template-loader', exclude: /node_modules/ }, | |
{ test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'sass-loader'] }, | |
{ test: /karma-require/, loader: 'null' } | |
] | |
} | |
}); | |
var compilerOptions = require('./src/tsconfig.spec.json').compilerOptions; | |
module.exports = function (wallaby) { | |
return { | |
files: [ | |
{ pattern: 'wallaby.*-*.js', load: false }, | |
{ pattern: 'src/**/*.ts', load: false }, | |
{ pattern: 'src/**/*.d.ts', ignore: true }, | |
{ pattern: 'src/**/*.css', load: false }, | |
{ pattern: 'src/**/*.less', load: false }, | |
{ pattern: 'src/**/*.scss', load: false }, | |
{ pattern: 'src/**/*.sass', load: false }, | |
{ pattern: 'src/**/*.styl', load: false }, | |
{ pattern: 'src/**/*.html', load: false }, | |
{ pattern: 'src/**/*.json', load: false }, | |
{ pattern: 'src/**/*spec.ts', ignore: true }, | |
], | |
tests: [ | |
{ pattern: 'src/**/*spec.ts', load: false } | |
], | |
testFramework: 'jasmine', | |
env: { | |
kind: 'chrome', | |
runner: require('puppeteer').executablePath() | |
}, | |
compilers: { | |
'**/*.ts': wallaby.compilers.typeScript(compilerOptions) | |
}, | |
postprocessor: webpackPostprocessor, | |
setup: function () { | |
window.__moduleBundler.loadTests(); | |
} | |
}; | |
}; |
This file contains hidden or 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
var testContext = require.context('./src', true, /\.spec\.ts/); | |
function requireAll(requireContext) { | |
return requireContext.keys().map(requireContext); | |
} | |
// requires and returns all modules that match | |
var modules = requireAll(testContext); |
This file contains hidden or 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
require('./src/polyfills'); | |
require('zone.js/dist/long-stack-trace-zone'); | |
require('zone.js/dist/proxy.js'); | |
require('zone.js/dist/sync-test'); | |
require('zone.js/dist/jasmine-patch'); | |
require('zone.js/dist/async-test'); | |
require('zone.js/dist/fake-async-test'); | |
var testing = require('@angular/core/testing'); | |
var browser = require('@angular/platform-browser-dynamic/testing'); | |
var testBed = testing.getTestBed(); | |
testBed.initTestEnvironment( | |
browser.BrowserDynamicTestingModule, | |
browser.platformBrowserDynamicTesting() | |
); | |
Object.assign(global, testing); | |
window.__karma__ && require('./wallaby.karma-require'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment