Stone, Avi (as206k) | 9b2ceb3 | 2018-04-12 16:36:39 +0300 | [diff] [blame] | 1 | var wallabyWebpack = require('wallaby-webpack'); |
| 2 | var path = require('path'); |
| 3 | |
| 4 | var compilerOptions = Object.assign( |
| 5 | require('./tsconfig.json').compilerOptions, |
| 6 | require('./src/tsconfig.spec.json').compilerOptions |
| 7 | ); |
| 8 | |
| 9 | compilerOptions.module = 'CommonJs'; |
| 10 | |
| 11 | module.exports = function(wallaby) { |
| 12 | var webpackPostprocessor = wallabyWebpack({ |
| 13 | entryPatterns: ['src/wallabyTest.js', 'src/**/*spec.js'], |
| 14 | |
| 15 | module: { |
| 16 | rules: [ |
| 17 | { test: /\.css$/, loader: ['raw-loader', 'css-loader'] }, |
| 18 | { test: /\.html$/, loader: 'raw-loader' }, |
| 19 | { |
| 20 | test: /\.ts$/, |
| 21 | loader: '@ngtools/webpack', |
| 22 | include: /node_modules/, |
| 23 | query: { tsConfigPath: 'tsconfig.json' } |
| 24 | }, |
| 25 | { |
| 26 | test: /\.js$/, |
| 27 | loader: 'angular2-template-loader', |
| 28 | exclude: /node_modules/ |
| 29 | }, |
| 30 | { test: /\.json$/, loader: 'json-loader' }, |
| 31 | { test: /\.styl$/, loaders: ['raw-loader', 'stylus-loader'] }, |
| 32 | { test: /\.less$/, loaders: ['raw-loader', 'less-loader'] }, |
| 33 | { test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'sass-loader'] }, |
| 34 | { test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' } |
| 35 | ] |
| 36 | }, |
| 37 | |
| 38 | resolve: { |
| 39 | extensions: ['.js', '.ts'], |
| 40 | modules: [ |
| 41 | path.join(wallaby.projectCacheDir, 'src/app'), |
| 42 | path.join(wallaby.projectCacheDir, 'src'), |
| 43 | 'node_modules' |
| 44 | ] |
| 45 | }, |
| 46 | node: { |
| 47 | fs: 'empty', |
| 48 | net: 'empty', |
| 49 | tls: 'empty', |
| 50 | dns: 'empty' |
| 51 | } |
| 52 | }); |
| 53 | |
| 54 | return { |
| 55 | files: [ |
| 56 | { |
| 57 | pattern: 'src/**/*.+(ts|css|less|scss|sass|styl|html|json|svg)', |
| 58 | load: false |
| 59 | }, |
| 60 | { pattern: 'src/**/*.d.ts', ignore: true }, |
| 61 | { pattern: 'src/**/*spec.ts', ignore: true } |
| 62 | ], |
| 63 | |
| 64 | tests: [ |
| 65 | { pattern: 'src/**/*spec.ts', load: false }, |
| 66 | { pattern: 'src/**/*e2e-spec.ts', ignore: true } |
| 67 | ], |
| 68 | |
| 69 | testFramework: 'jasmine', |
| 70 | |
| 71 | compilers: { |
| 72 | '**/*.ts': wallaby.compilers.typeScript(compilerOptions) |
| 73 | }, |
| 74 | |
| 75 | middleware: function(app, express) { |
| 76 | var path = require('path'); |
| 77 | app.use( |
| 78 | '/favicon.ico', |
| 79 | express.static(path.join(__dirname, 'src/favicon.ico')) |
| 80 | ); |
| 81 | app.use('/assets', express.static(path.join(__dirname, 'src/assets'))); |
| 82 | }, |
| 83 | |
| 84 | env: { |
| 85 | kind: 'electron' |
| 86 | }, |
| 87 | |
| 88 | postprocessor: webpackPostprocessor, |
| 89 | |
| 90 | setup: function() { |
| 91 | window.__moduleBundler.loadTests(); |
| 92 | }, |
| 93 | |
| 94 | debug: true |
| 95 | }; |
| 96 | }; |