Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Create a command to run tests on file change:
Browse files Browse the repository at this point in the history
npm run test-live
  • Loading branch information
slaweet committed Mar 17, 2017
1 parent 89df8c0 commit 1238e73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ preprocessors[test] = ['webpack'];

var opts = {
onTravis: process.env.ON_TRAVIS,
live: process.env.LIVE,
};

module.exports = function(config) {
Expand Down Expand Up @@ -57,7 +58,7 @@ module.exports = function(config) {


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
autoWatch: opts.live,

ngHtml2JsPreprocessor: {
stripPrefix: 'app/components/',
Expand All @@ -77,7 +78,7 @@ module.exports = function(config) {

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
singleRun: !opts.live,
client: {
mocha: {
opts: 'test/mocha.opts' // You can set opts to equal true then plugin will load opts from default location 'test/mocha.opts'
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"build": "webpack --profile --progress --display-modules --display-exclude --display-chunks --display-cached --display-cached-assets",
"dev": "webpack-dev-server --host 0.0.0.0 --profile --progress",
"test": "export NODE_ENV=test && karma start"
"test": "export NODE_ENV=test && karma start",
"test-live": "export NODE_ENV=test && export LIVE=true && karma start"
},
"dependencies": {
"angular": "=1.5.8",
Expand Down

0 comments on commit 1238e73

Please sign in to comment.