forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(karma): add browser testing capability
Signed-off-by: suyukuoacn <su-yu.kuo@accenture.com>
- Loading branch information
1 parent
4563874
commit a51684c
Showing
7 changed files
with
2,199 additions
and
75 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 |
---|---|---|
|
@@ -7,6 +7,7 @@ docs/main | |
logs/ | ||
jspm_packages/ | ||
generated-sources/ | ||
coverage/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
module.exports = (config) => { | ||
config.set({ | ||
singleRun: true, | ||
logLevel: config.LOG_INFO, | ||
colors: true, | ||
|
||
frameworks: ["tap"], | ||
|
||
// Use "Chrome" if you need to debug tests with the actual browser window | ||
// being open and you want to use Chrome Dev Tools for it. | ||
browsers: [ | ||
// 'Electron', | ||
// "ElectronWithGui", | ||
// 'Chrome', | ||
// 'ChromeHeadless', | ||
"ChromeHeadlessDebug", | ||
], | ||
|
||
files: [ | ||
{ | ||
pattern: "packages/cactus-common/src/test/typescript/unit/**/*.ts", | ||
}, | ||
], | ||
|
||
plugins: [ | ||
"karma-chrome-launcher", | ||
"karma-electron", | ||
"karma-tap", | ||
"karma-webpack", | ||
], | ||
|
||
preprocessors: { | ||
"**/*.ts": ["webpack"], | ||
}, | ||
|
||
browserConsoleLogOptions: { | ||
level: "debug", | ||
format: "%b %T: %m", | ||
terminal: true, | ||
}, | ||
|
||
reporters: ["dots"], | ||
|
||
webpack: { | ||
mode: "development", | ||
devtool: "inline-source-map", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
use: [ | ||
{ | ||
loader: "ts-loader", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: [".ts", ".js"], | ||
}, | ||
node: { | ||
fs: "empty", | ||
}, | ||
}, | ||
|
||
webpackMiddleware: { | ||
// without this the webpack compilation log is shown as well | ||
stats: "errors-only", | ||
}, | ||
|
||
customLaunchers: { | ||
ElectronWithGui: { | ||
base: "Electron", | ||
flags: [ | ||
"--show", | ||
"--disable-translate", | ||
"--disable-extensions", | ||
"--no-first-run", | ||
"--disable-background-networking", | ||
"--remote-debugging-port=9222", | ||
"--remote-debugging-address=127.0.0.1", | ||
], | ||
}, | ||
|
||
ChromeHeadlessDebug: { | ||
base: "ChromeHeadless", | ||
flags: [ | ||
"--disable-translate", | ||
"--disable-extensions", | ||
"--no-first-run", | ||
"--disable-background-networking", | ||
"--remote-debugging-port=9222", | ||
"--remote-debugging-address=127.0.0.1", | ||
], | ||
}, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.