Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit bc72e36

Browse files
committedOct 25, 2015
add run sequence
1 parent 25f9077 commit bc72e36

7 files changed

+28
-13
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
some-test.js
33
npm-debug.log
4+
sauce_connect.log

‎gulpfile.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ var Server = require('karma').Server
33
var mocha = require('gulp-mocha')
44
var ipfsd = require('ipfsd-ctl')
55
var fs = require('fs')
6+
var runSequence = require('run-sequence')
67

7-
gulp.task('default', function () {
8-
gulp.start('test:node', 'test:browser')
8+
gulp.task('default', function (done) {
9+
runSequence(
10+
'test:node',
11+
// 'test:browser',
12+
done)
913
})
1014

1115
gulp.task('test:node', function (done) {
@@ -19,16 +23,25 @@ gulp.task('test:node', function (done) {
1923
.once('end', function () {
2024
stopDisposableDaemons(daemons, function () {
2125
process.exit()
26+
// done()
2227
})
2328
})
2429
})
2530
})
2631

2732
gulp.task('test:browser', function (done) {
28-
new Server({
29-
configFile: __dirname + '/karma.conf.js',
30-
singleRun: true
31-
}, done).start()
33+
startDisposableDaemons(function (daemons) {
34+
new Server({
35+
configFile: __dirname + '/karma.conf.js',
36+
singleRun: true
37+
}, finish).start()
38+
39+
function finish () {
40+
stopDisposableDaemons(daemons, function () {
41+
done()
42+
})
43+
}
44+
})
3245
})
3346

3447
function startDisposableDaemons (callback) {
@@ -54,10 +67,9 @@ function startDisposableDaemons (callback) {
5467
throw err
5568
}
5669

57-
console.log('ipfs init done - ' + key)
5870
ipfsNodes[key] = node
5971

60-
console.log('ipfs config (bootstrap and mdns off) - ' + key)
72+
console.log(' ipfs init done - (bootstrap and mdns off) - ' + key)
6173

6274
ipfsNodes[key].setConfig('Bootstrap', null, function (err) {
6375
if (err) {

‎karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function (config) {
3939
basePath: '',
4040
frameworks: ['browserify', 'mocha'],
4141
files: [
42-
'test/test.js'
42+
'test/tests.js'
4343
],
4444
exclude: [],
4545
preprocessors: {

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
"karma-sauce-launcher": "^0.3.0",
3838
"mocha": "^2.3.3",
3939
"pre-commit": "^1.0.6",
40+
"run-sequence": "^1.1.4",
4041
"standard": "^5.2.2",
4142
"uglify-js": "^2.4.24"
4243
},
4344
"scripts": {
4445
"test": "./node_modules/.bin/gulp",
4546
"test:node": "./node_modules/.bin/gulp test:node",
4647
"test:browser": "./node_modules/.bin/gulp test:browser",
47-
4848
"lint": "./node_modules/.bin/standard",
4949
"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"
5050
},

‎src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function IpfsAPI (host_or_multiaddr, port) {
138138

139139
self.swarm = {
140140
peers: command('swarm/peers'),
141-
connect: argCommand('swarm/peers')
141+
connect: argCommand('swarm/connect')
142142
}
143143

144144
self.ping = function (id, cb) {

‎test/tests.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ describe('IPFS Node.js API wrapper tests', function () {
5050
}
5151

5252
function dial () {
53-
apiClients['a'].swarm.connect(addrs['b'], function (err) {
53+
console.log(addrs)
54+
apiClients['a'].swarm.connect(addrs['b'], function (err, res) {
55+
console.log('->', res)
5456
if (err) {
5557
throw err
5658
}

‎test/tmp-disposable-nodes-addrs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"b":"/ip4/127.0.0.1/tcp/52153","c":"/ip4/127.0.0.1/tcp/52166","a":"/ip4/127.0.0.1/tcp/52169"}
1+
{"a":"/ip4/127.0.0.1/tcp/56689","b":"/ip4/127.0.0.1/tcp/56694","c":"/ip4/127.0.0.1/tcp/56697"}

0 commit comments

Comments
 (0)
This repository has been archived.