Skip to content

Commit

Permalink
chore(karma): Update karma config for webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Mar 21, 2018
1 parent 008c6f9 commit 3bc8380
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 4 additions & 10 deletions karma-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@ Error.stackTraceLimit = Infinity;
// jquery has to be first or many a test will break
global.$ = global.jQuery = require('jquery');

require('./settings.js');
require('./app/scripts/app');

// angular 1 test harnesss
const angular = require('angular');
require('angular-mocks');

// polyfills
require('core-js/client/shim');

require('rxjs');

require('./settings.js');

require('ngimport');
beforeEach(angular.mock.module('bcherny/ngimport'));

require('./test/helpers/customMatchers');

const testContext = require.context('./app/scripts/', true, /\.spec\.(js|ts|tsx)$/);
testContext.keys().filter(k => !k.includes('/lib/')).forEach(testContext);
testContext.keys().forEach(testContext);
5 changes: 3 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (config) {
autoWatch: true,

// base path, that will be used to resolve files and exclude
basePath: '',
basePath: '.',

// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],
Expand All @@ -27,7 +27,7 @@ module.exports = function (config) {
],

preprocessors: {
'./karma-shim.js': ['webpack']
'./karma-shim.js': ['webpack', 'sourcemap']
},

webpack: webpackConfig,
Expand All @@ -53,6 +53,7 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-junit-reporter'),
require('karma-mocha-reporter'),
require('karma-sourcemap-loader'),
],

// list of files / patterns to exclude
Expand Down

0 comments on commit 3bc8380

Please sign in to comment.