Skip to content

Commit e3d6d5c

Browse files
author
Albin Mattsson
committed
Add Travis configuration
This closes #108
1 parent 67fa3f8 commit e3d6d5c

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
language: node_js
2+
osx_image: xcode7.3
3+
os:
4+
- osx
5+
node_js:
6+
- 6
7+
script:
8+
- defaults write NSGlobalDomain AppleShowAllExtensions -bool true
9+
- npm test

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"fs-temp": "^1.0.0",
1515
"fs-xattr": "^0.1.14",
1616
"image-size": "^0.5.0",
17+
"imgur": "^0.1.7",
1718
"is-my-json-valid": "^2.13.1",
1819
"minimist": "^1.1.3",
1920
"parse-color": "^1.0.0",

test/lib/visually-verify-image.js

+23-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var looksSame = require('looks-same')
44
var spawnSync = require('child_process').spawnSync
55
var captureWindow = require('capture-window')
66
var sizeOf = require('image-size')
7+
var imgur = require('imgur')
78

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

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

66-
temp.writeFile(data, function (err, diffPath) {
67-
if (err) return cb(err)
68-
69-
cb(null, { diff: diffPath, actual: pngPath })
70-
})
67+
if (process.env.CI) {
68+
imgur.uploadFile(pngPath)
69+
.then(function (json) {
70+
const pngUrl = json.data.link
71+
imgur.uploadBase64(data.toString('base64'))
72+
.then(function (json) {
73+
cb(null, { diff: json.data.link, actual: pngUrl })
74+
})
75+
.catch(function (err) {
76+
cb(err)
77+
})
78+
})
79+
.catch(function (err) {
80+
cb(err)
81+
})
82+
} else {
83+
temp.writeFile(data, function (err, diffPath) {
84+
if (err) return cb(err)
85+
86+
cb(null, { diff: diffPath, actual: pngPath })
87+
})
88+
}
7189
})
7290
})
7391
}

0 commit comments

Comments
 (0)