Skip to content

Commit

Permalink
Merge pull request #174 from smartprocure/test/karma-output-json
Browse files Browse the repository at this point in the history
Test/karma output json
  • Loading branch information
daedalus28 committed Oct 28, 2017
2 parents a38142f + 8b1ad23 commit 9c18e4f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
command: npm run cicoverage
- run:
name: browser
command: if [ "${CIRCLE_BRANCH}" != "master" ]; then npm run browser; fi;
command: if [ "${CIRCLE_BRANCH}" != "master" ]; then npm run browser || true; fi;
- run:
name: pre-danger
command: git config user.email "drodriguez@smartprocure.us" && git config user.name "Decrapifier" && git config push.default upstream && git branch -u origin/$CIRCLE_BRANCH
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ lib

# Package lock files
package-lock.json

# Browser test result file
browser-results.json
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# 1.34.0
# 1.34.1
- Ignore browser testing errors.
- Add karma JSON reporter.
- Only watch files and record videos/screenshots for the local test.

# 1.34.0
- Fixed flattenObject and diffArray to properly say the paths of
arrays with only one object, by making them use a new function:
`dotJoinWith`, which is like `dotJoin` but allows you to provide a
Expand Down
16 changes: 11 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ module.exports = function(config) {

let browsers
let reporters
let jsonReporter = {
stdout: false,
outputFile: 'browser-results.json', // defaults to none
}

switch (process.env.TEST_ENV) {
case 'browser':
browsers = Object.keys(customLaunchers)
reporters = ['dots', 'saucelabs']
reporters = ['dots', 'json', 'saucelabs']
break
// default is local
default:
local = true
browsers = ['Chrome']
reporters = ['progress']
reporters = ['progress', 'json']
}

config.set({
Expand Down Expand Up @@ -92,6 +96,8 @@ module.exports = function(config) {
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: reporters,
// Write testing results to json file.
jsonReporter: jsonReporter,

// web server port
port: 9876,
Expand All @@ -104,15 +110,15 @@ module.exports = function(config) {
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
autoWatch: local,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// browsers: ['Chrome'],
sauceLabs: {
testName: 'Futil-js browser tests',
recordVideo: true,
recordScreenshots: true,
recordVideo: local,
recordScreenshots: local,
},
captureTimeout: 360 * 1000,
browserNoActivityTimeout: 600 * 1000,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "futil-js",
"version": "1.34.0",
"version": "1.34.1",
"description": "F(unctional) util(ities). Resistance is futile.",
"main": "lib/futil-js.js",
"scripts": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"karma-chai": "^0.1.0",
"karma-chai-as-promised": "^0.1.2",
"karma-chrome-launcher": "^2.2.0",
"karma-json-reporter": "^1.2.1",
"karma-mocha": "^1.3.0",
"karma-sauce-launcher": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
Expand Down

0 comments on commit 9c18e4f

Please sign in to comment.