-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: davimarinho <[email protected]>
- Loading branch information
1 parent
74956b8
commit 55c6c1b
Showing
1 changed file
with
69 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,71 @@ | ||
module.exports = function(config) { | ||
config.set({ | ||
basePath: '../..', | ||
frameworks: ['jasmine'], | ||
browsers: [ | ||
'Chrome', | ||
'ChromeHeadlessCI' | ||
module.exports = (config) => { | ||
const coverage = config.singleRun ? ["coverage"] : []; | ||
|
||
config.set({ | ||
frameworks: ["jasmine"], | ||
plugins: [ | ||
"karma-jasmine", | ||
"karma-webpack", | ||
"karma-coverage", | ||
"karma-remap-istanbul", | ||
"karma-chrome-launcher", | ||
], | ||
customLaunchers: { | ||
ChromeHeadlessCI: { | ||
base: 'ChromeHeadless', | ||
flags: ['--no-sandbox'] | ||
} | ||
files: [ | ||
"./src/tests.entry.ts", | ||
{ | ||
pattern: "**/*.map", | ||
served: true, | ||
included: false, | ||
watched: true, | ||
}, | ||
], | ||
preprocessors: { | ||
"./src/tests.entry.ts": ["webpack", "sourcemap"], | ||
"./src/**/!(*.test|tests.*).(ts|js)": ["sourcemap"], | ||
}, | ||
|
||
webpack: { | ||
plugins, | ||
entry: "./src/tests.entry.ts", | ||
devtool: "inline-source-map", | ||
resolve: { | ||
extensions: [".webpack.js", ".web.js", ".ts", ".js"], | ||
}, | ||
module: { | ||
rules: combinedLoaders().concat( | ||
config.singleRun ? [loaders.istanbulInstrumenter] : [] | ||
), | ||
}, | ||
stats: { colors: true, reasons: true }, | ||
}, | ||
webpackServer: { | ||
noInfo: true, // prevent console spamming when running in Karma! | ||
}, | ||
|
||
reporters: ["spec"] | ||
.concat(coverage) | ||
.concat(coverage.length > 0 ? ["karma-remap-istanbul"] : []), | ||
|
||
remapIstanbulReporter: { | ||
src: "coverage/chrome/coverage-final.json", | ||
reports: { | ||
html: "coverage", | ||
}, | ||
}, | ||
|
||
coverageReporter: { | ||
reporters: [{ type: "json" }], | ||
dir: "./coverage/", | ||
subdir: (browser) => { | ||
return browser.toLowerCase().split(/[ /-]/)[0]; // returns 'chrome' | ||
}, | ||
}, | ||
}) | ||
}; | ||
|
||
port: 9876, | ||
browsers: ["Chrome"], // Alternatively: 'PhantomJS' | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
captureTimeout: 6000, | ||
}); | ||
}; |