-
Notifications
You must be signed in to change notification settings - Fork 296
Start implementing browser tests using karma #78
Changes from 9 commits
e5ddc7f
700d6f6
a184f1a
105fb32
1934220
2ea7f73
dc39d98
1665b27
11b07d3
6ddd117
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- "4.0" | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
module.exports = function (config) { | ||
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { | ||
console.log('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.') | ||
process.exit(1) | ||
} | ||
|
||
// Browsers to run on Sauce Labs | ||
// Check out https://saucelabs.com/platforms for all browser/OS combos | ||
var customLaunchers = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably have something running on Linux as well, just in case. Might be overkill though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Launcher list should be bigger anyway probably, but just wanted to add sth for now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough |
||
'SL_Chrome': { | ||
base: 'SauceLabs', | ||
platform: 'OS X 10.11', | ||
browserName: 'chrome' | ||
}, | ||
'SL_Firefox': { | ||
base: 'SauceLabs', | ||
platform: 'OS X 10.11', | ||
browserName: 'firefox' | ||
}, | ||
'SL_Safari': { | ||
base: 'SauceLabs', | ||
platform: 'OS X 10.11', | ||
browserName: 'safari' | ||
}, | ||
'SL_Edge': { | ||
base: 'SauceLabs', | ||
platform: 'Windows 10', | ||
browserName: 'microsoftedge' | ||
}, | ||
'SL_IE11': { | ||
base: 'SauceLabs', | ||
platform: 'Windows 10', | ||
browserName: 'internet explorer', | ||
version: '11.0' | ||
} | ||
} | ||
|
||
config.set({ | ||
basePath: '', | ||
frameworks: ['browserify', 'mocha'], | ||
files: [ | ||
'test/test.js' | ||
], | ||
exclude: [], | ||
preprocessors: { | ||
'test/**/*.js': ['browserify'] | ||
}, | ||
|
||
browserify: { | ||
debug: true, | ||
transform: [ | ||
'brfs' | ||
] | ||
}, | ||
|
||
sauceLabs: { | ||
testName: 'node-ipfs-api', | ||
recordScreenshots: false, | ||
connectOptions: { | ||
port: 5757, | ||
logfile: 'sauce_connect.log' | ||
} | ||
}, | ||
|
||
reporters: ['progress', 'saucelabs'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: false, | ||
customLaunchers: customLaunchers, | ||
browsers: Object.keys(customLaunchers), | ||
singleRun: false, | ||
concurrency: 2 | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,15 +25,24 @@ | |
"url": "https://github.com/ipfs/node-ipfs-api" | ||
}, | ||
"devDependencies": { | ||
"brfs": "^1.4.1", | ||
"browserify": "^11.0.0", | ||
"concurrently": "^0.1.1", | ||
"go-ipfs": "^0.3.6", | ||
"ipfsd-ctl": "^0.5.1", | ||
"mocha": "^2.2.5", | ||
"karma": "^0.13.11", | ||
"karma-browserify": "^4.4.0", | ||
"karma-mocha": "^0.2.0", | ||
"karma-sauce-launcher": "^0.3.0", | ||
"mocha": "^2.3.3", | ||
"pre-commit": "^1.0.6", | ||
"standard": "^5.2.2", | ||
"uglify-js": "^2.4.24" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha", | ||
"test": "ls -la node_modules/.bin && npm run test:node && npm run test:browser", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ts command should be here I guess, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah that was just for debugging :) |
||
"test:node": "./node_modules/.bin/mocha", | ||
"test:browser": "./node_modules/.bin/ipfs init && API_ORIGIN=\"*\" ./node_modules/.bin/concurrent --kill-others \"./node_modules/.bin/ipfs daemon\" \"./node_modules/.bin/karma start --single-run=true karma.conf.js\"", | ||
"lint": "./node_modules/.bin/standard", | ||
"build": "./node_modules/.bin/browserify -t brfs -s ipfsAPI -e ./src/index.js | tee dist/ipfsapi.js | ./node_modules/.bin/uglifyjs -m > dist/ipfsapi.min.js" | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll need this to be able to run in local? I think this should be optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, not sure of the best way to do that, suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract the SauceLabs specific parts that only get added if
process.env.SAUCE_USERNAME
andSAUCE_ACCESS_KEY
is set would be a simple way to achieve it.