Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
feat: porting to new aegir (#70)
Browse files Browse the repository at this point in the history
* feat: porting to new aegir

* chore: adding missing dep

* feat: add global timeout to avoid touching interface-stream-muxer

* fix: use Buffer.from

* chore: timeout

* fix: timeouts
  • Loading branch information
dryajov authored and daviddias committed Dec 14, 2017
1 parent 3ee5751 commit 30fc825
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
19 changes: 12 additions & 7 deletions gulpfile.js → .aegir.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use strict'

const gulp = require('gulp')
const WSlibp2p = require('libp2p-websockets')
const multiaddr = require('multiaddr')
const pull = require('pull-stream')

const multiplex = require('./src')

let listener

gulp.task('test:browser:before', (done) => {
const boot = (done) => {
const ws = new WSlibp2p()
const mh = multiaddr('/ip4/127.0.0.1/tcp/9095/ws')
listener = ws.createListener((transportSocket) => {
Expand All @@ -21,10 +19,17 @@ gulp.task('test:browser:before', (done) => {
})

listener.listen(mh, done)
})
}

gulp.task('test:browser:after', (done) => {
const shutdown = (done) => {
listener.close(done)
})
}

require('aegir/gulp')(gulp)
module.exports = {
hooks: {
browser: {
pre: boot,
post: shutdown
}
}
}
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"description": "multiplex implementation wrapper that is compatible with libp2p Stream Muxer expected interface",
"main": "src/index.js",
"scripts": {
"lint": "gulp lint",
"build": "gulp build",
"test": "gulp test",
"test:node": "gulp test:node",
"test:browser": "gulp test:browser",
"release": "gulp release",
"release-minor": "gulp release --type minor",
"release-major": "gulp release --type major",
"coverage": "gulp coverage",
"coverage-publish": "aegir-coverage publish"
"lint": "aegir lint",
"build": "aegir build",
"test": "aegir test -t node -t browser",
"test:node": "aegir test -t node",
"test:browser": "aegir test -t browser",
"release": "aegir release -t node -t browser",
"release-minor": "aegir release --type minor -t node -t browser",
"release-major": "aegir release --type major -t node -t browser",
"coverage": "aegir coverage",
"coverage-publish": "aegir coverage --provider coveralls"
},
"repository": {
"type": "git",
Expand All @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-multiplex#readme",
"devDependencies": {
"aegir": "^11.0.2",
"aegir": "^12.2.0",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"interface-stream-muxer": "~0.5.7",
Expand All @@ -44,6 +44,7 @@
"pull-catch": "^1.0.0",
"pull-stream": "^3.6.0",
"pull-stream-to-stream": "^1.3.4",
"pump": "^2.0.0",
"stream-to-pull-stream": "^1.7.2"
},
"contributors": [
Expand All @@ -55,4 +56,4 @@
"Victor Bjelkholm <[email protected]>",
"greenkeeperio-bot <[email protected]>"
]
}
}
4 changes: 2 additions & 2 deletions test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ describe('browser-server', () => {
conn,
pull.collect((err, chunks) => {
expect(err).to.not.exist()
expect(chunks).to.be.eql([new Buffer('hey')])
expect(chunks).to.be.eql([Buffer.from('hey')])
pull(pull.empty(), conn)
})
)
})

pull(
pull.values([new Buffer('hey')]),
pull.values([Buffer.from('hey')]),
muxedConn.newStream(),
pull.onEnd(done)
)
Expand Down
6 changes: 3 additions & 3 deletions test/multiplex.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('multiplex-generic', () => {
conn,
pull.collect((err, res) => {
expect(err).to.not.exist()
expect(res).to.eql([new Buffer('hello')])
expect(res).to.eql([Buffer.from('hello')])
done()
})
)
Expand All @@ -58,11 +58,11 @@ describe('multiplex-generic', () => {

const conn = listener.newStream()
pull(
pull.values([new Buffer('hello')]),
pull.values([Buffer.from('hello')]),
conn,
pull.collect((err, res) => {
expect(err).to.not.exist()
expect(res).to.eql([new Buffer('hello')])
expect(res).to.eql([Buffer.from('hello')])
done()
})
)
Expand Down

0 comments on commit 30fc825

Please sign in to comment.