Skip to content

Commit bb7a96a

Browse files
committed
improve performance of karma
1 parent 0210237 commit bb7a96a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

karma.conf.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ module.exports = config => {
1919
"es6-shim"
2020
],
2121
files: [
22-
{ pattern: "./test/**/**/**.test.ts", include: true },
22+
{ pattern: "./test/index.ts", include: true },
2323
{ pattern: '**/*.map', served: true, included: false, watched: true }
2424
],
2525
preprocessors: {
26-
"./**/**/**/**.ts": ["sourcemap"],
27-
"./test/**/**/**.test.ts": ["webpack"]
26+
"./test/index.ts": ["webpack"],
27+
"./**/**/**/**.ts": ["sourcemap"]
2828
},
2929
webpack: webpackConfig,
3030
webpackMiddleware: {
@@ -41,6 +41,9 @@ module.exports = config => {
4141
"karma-es6-shim",
4242
"karma-coverage-istanbul-reporter"
4343
],
44+
mime: {
45+
"text/x-typescript": ["ts","tsx"]
46+
},
4447
reporters: (
4548
config.singleRun ?
4649
["dots", "mocha", "coverage-istanbul"] :

test/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference types="webpack-env" />
2+
3+
// require all modules ending in ".test.ts" from the
4+
// current directory and all subdirectories
5+
const testsContext = require.context(".", true, /\.test\.ts$/);
6+
7+
testsContext.keys().forEach(testsContext);

0 commit comments

Comments
 (0)