Skip to content

setup Karma config #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules/
dist/
dist.es5/
build/
package-lock.json
.nyc_output/
coverage/
benchmark/sandbox.ts
Expand Down
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# https://docs.travis-ci.com/user/languages/javascript-with-nodejs/
language: node_js
addons:
firefox: latest
node_js:
- "10"
- "12"
- "lts/*"
- "node"
cache: npm
before_install: npm install -g nyc codecov
script: npm run test:cover
install:
- npm install -g nyc codecov
- npm ci
script:
- npm run test:browser:firefox
- npm run test:cover
after_success:
- nyc report --reporter=json > coverage/coverage.json
- codecov
61 changes: 61 additions & 0 deletions karma.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const webpackConfig = require("./webpack.config.js");

export default function configure(config: any) {
config.set({
browsers: ["FirefoxHeadless", "ChromeHeadless"],

basePath: "",
frameworks: ["mocha"],
files: ["./test/karma-run.ts"],
exclude: [],
preprocessors: {
"**/*.ts": ["webpack", "sourcemap"],
},
reporters: ["mocha"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: false,
concurrency: 2,

webpack: {
mode: "development",

// Handles NodeJS polyfills
// https://webpack.js.org/configuration/node
// Note that the dependencies in https://github.com/webpack/node-libs-browser are sometimes too old.
node: {
assert: false,
util: false,
buffer: false,
},
resolve: {
...webpackConfig.resolve,
alias: {
assert$: "assert/assert.js",
},
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
options: {
configFile: "tsconfig.karma.json",
// FIXME: some types for dependencies cannot be resolved, so ignore type checking for now.
transpileOnly: true,
},
},
],
},
optimization: {
minimize: false,
},
devtool: "inline-source-map",
},
mime: {
"text/x-typescript": ["ts", "tsx"],
},
});
}
Loading