Skip to content

Commit

Permalink
Add Travis configuration
Browse files Browse the repository at this point in the history
This closes #108
  • Loading branch information
Albin Mattsson committed May 22, 2016
1 parent 67fa3f8 commit 9abcb1a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
osx_image: xcode7.3
os:
- osx
node_js:
- 6
script:
- sw_vers -productVersion
- defaults write NSGlobalDomain AppleShowAllExtensions -bool true
- killall Finder
- npm test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"devDependencies": {
"capture-window": "^0.1.3",
"imgur": "^0.1.7",
"looks-same": "^2.1.0",
"mocha": "^2.2.5",
"standard": "^7.0.1"
Expand Down
28 changes: 23 additions & 5 deletions test/lib/visually-verify-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var looksSame = require('looks-same')
var spawnSync = require('child_process').spawnSync
var captureWindow = require('capture-window')
var sizeOf = require('image-size')
var imgur = require('imgur')

var hdiutil = require('../../lib/hdiutil')

Expand Down Expand Up @@ -63,11 +64,28 @@ function captureAndSaveDiff (title, expectedPath, cb) {
looksSame.createDiff(opts, function (err, data) {
if (err) return cb(err)

temp.writeFile(data, function (err, diffPath) {
if (err) return cb(err)

cb(null, { diff: diffPath, actual: pngPath })
})
if (process.env.CI) {
imgur.uploadFile(pngPath)
.then(function (json) {
const pngUrl = json.data.link
imgur.uploadBase64(data.toString('base64'))
.then(function (json) {
cb(null, { diff: json.data.link, actual: pngUrl })
})
.catch(function (err) {
cb(err)
})
})
.catch(function (err) {
cb(err)
})
} else {
temp.writeFile(data, function (err, diffPath) {
if (err) return cb(err)

cb(null, { diff: diffPath, actual: pngPath })
})
}
})
})
}
Expand Down

0 comments on commit 9abcb1a

Please sign in to comment.