Skip to content
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
dist: trusty
addons:
chrome: stable
language: node_js
node_js:
- stable
Expand All @@ -14,7 +17,7 @@ before_install:
before_script:
- greenkeeper-lockfile-update
script:
- yarn run test
- yarn test
after_script:
- greenkeeper-lockfile-upload
after_success:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

- Update `karma` setup to generate code coverage report only for `src` folder (see #69).

- Migrate to Headless Chrome and improve performance of Karma (see #75).

- Update dev dependencies to latest version.

### [v0.2.0](https://github.com/RobotlegsJS/RobotlegsJS-SignalCommandMap/releases/tag/0.2.0) - 2018-08-02
Expand Down
27 changes: 16 additions & 11 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
const puppeteer = require('puppeteer');

process.env.TEST = true;
process.env.NODE_ENV = "test";
process.env.CHROME_BIN = puppeteer.executablePath();

const webpackConfig = require("./webpack.config.js")({ production: false, karma: true });

delete webpackConfig.entry;

module.exports = config => {
"use strict";

var configuration = {
basePath: "",
frameworks: [
"mocha",
"chai",
"sinon",
"sinon-chai",
"es6-shim"
],
files: [
{ pattern: "node_modules/reflect-metadata/Reflect.js", include: true },
{ pattern: "node_modules/bluebird/js/browser/bluebird.js", include: true },
{ pattern: "./test/**/**/**.test.ts", include: true },
{ pattern: "./test/index.ts", include: true },
{ pattern: '**/*.map', served: true, included: false, watched: true }
],
preprocessors: {
"./**/**/**/**.ts": ["sourcemap"],
"./test/**/**/**.test.ts": ["webpack"]
"./test/index.ts": ["webpack"],
"./**/**/**/**.ts": ["sourcemap"]
},
webpack: webpackConfig,
webpackMiddleware: {
Expand All @@ -36,11 +39,13 @@ module.exports = config => {
"karma-remap-istanbul",
"karma-mocha-reporter",
"karma-mocha",
"karma-chai",
"karma-sinon",
"karma-sinon-chai",
"karma-es6-shim",
"karma-coverage-istanbul-reporter"
],
mime: {
"text/x-typescript": ["ts","tsx"]
},
reporters: (
config.singleRun ?
["dots", "mocha", "coverage-istanbul"] :
Expand All @@ -65,11 +70,11 @@ module.exports = config => {
};

if (process.env.TRAVIS) {
configuration.browsers.push("PhantomJS");
configuration.plugins.push("karma-phantomjs-launcher");
configuration.browsers.push("ChromeHeadless");
configuration.plugins.push("karma-chrome-launcher");
} else {
configuration.browsers.push("PhantomJS");
configuration.plugins.push("karma-phantomjs-launcher");
configuration.browsers.push("ChromeHeadless");
configuration.plugins.push("karma-chrome-launcher");
}

config.set(configuration);
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"@types/bluebird": "^3.5.24",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/sinon": "^5.0.6",
"@types/sinon": "^5.0.7",
"@types/webpack-env": "^1.13.6",
"bluebird": "^3.5.3",
"browserify-versionify": "^1.0.6",
"chai": "^4.2.0",
Expand All @@ -83,27 +84,25 @@
"istanbul": "^0.4.5",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^3.1.1",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-es6-shim": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",
"karma-remap-istanbul": "^0.6.0",
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^2.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-sourcemap-writer": "^0.1.2",
"karma-webpack": "^3.0.5",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"prettier": "^1.15.2",
"publish-please": "^5.2.0",
"publish-please": "^5.3.0",
"puppeteer": "^1.10.0",
"reflect-metadata": "^0.1.12",
"remap-istanbul": "^0.12.0",
"rimraf": "^2.6.2",
"sinon": "^5.1.1",
"sinon": "^7.1.1",
"sinon-chai": "^3.2.0",
"source-map-support": "^0.5.9",
"ts-loader": "^5.3.0",
Expand Down
7 changes: 7 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// <reference types="webpack-env" />

// require all modules ending in ".test.ts" from the
// current directory and all subdirectories
const testsContext = require.context(".", true, /\.test\.ts$/);

testsContext.keys().forEach(testsContext);
Loading