Skip to content

Commit

Permalink
Merge pull request #20 from msgpack/karma-config
Browse files Browse the repository at this point in the history
setup Karma config
  • Loading branch information
gfx authored May 10, 2019
2 parents aa304c4 + 1cac63b commit cea0061
Show file tree
Hide file tree
Showing 7 changed files with 6,477 additions and 5 deletions.
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

0 comments on commit cea0061

Please sign in to comment.