Skip to content

Commit d504040

Browse files
authored
test: add pull-mplex to test suite (libp2p#305)
* chore: use travis * chore: update dependencies
1 parent 86e0a7a commit d504040

14 files changed

+302
-242
lines changed

.aegir.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const pull = require('pull-stream')
88
const PeerBook = require('peer-book')
99

1010
const Switch = require('./src')
11+
const mplex = require('pull-mplex')
1112
const spdy = require('libp2p-spdy')
1213
const fs = require('fs')
1314
const path = require('path')
@@ -54,6 +55,7 @@ function pre (done) {
5455
switchB = new Switch(peerB, new PeerBook())
5556

5657
switchB.transport.add('ws', new WebSockets())
58+
switchB.connection.addStreamMuxer(mplex)
5759
switchB.connection.addStreamMuxer(spdy)
5860
switchB.connection.reuse()
5961
switchB.handle('/echo/1.0.0', echo)

.travis.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
language: node_js
2+
cache: npm
3+
stages:
4+
- check
5+
- test
6+
- cov
7+
8+
node_js:
9+
- '10'
10+
11+
os:
12+
- linux
13+
- osx
14+
- windows
15+
16+
script: npx nyc -s npm run test:node -- --bail
17+
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
18+
19+
jobs:
20+
include:
21+
- stage: check
22+
script:
23+
- npx aegir commitlint --travis
24+
- npx aegir dep-check
25+
- npm run lint
26+
27+
- stage: test
28+
name: chrome
29+
addons:
30+
chrome: stable
31+
script: npx aegir test -t browser
32+
33+
- stage: test
34+
name: firefox
35+
addons:
36+
firefox: latest
37+
script: npx aegir test -t browser -- --browsers FirefoxHeadless
38+
39+
notifications:
40+
email: false
41+

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ libp2p-switch JavaScript implementation
44
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
55
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
66
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
7-
[![Build Status](https://img.shields.io/travis/libp2p/js-libp2p-switch/master.svg?style=flat-square)](https://travis-ci.org/libp2p/js-libp2p-switch)
8-
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-switch.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-switch)
9-
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-switch/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-switch?branch=master)
7+
[![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-switch)](https://travis-ci.com/libp2p/js-libp2p-switch)
8+
[![codecov](https://codecov.io/gh/libp2p/js-libp2p-switch/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/js-libp2p-switch)
109
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-switch.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-switch)
1110
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
1211
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)

ci/Jenkinsfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,28 @@
4040
"npm": ">=3.0.0"
4141
},
4242
"devDependencies": {
43-
"aegir": "^18.0.3",
43+
"aegir": "^18.1.0",
4444
"chai": "^4.2.0",
4545
"chai-checkmark": "^1.0.1",
4646
"dirty-chai": "^2.0.1",
4747
"libp2p-mplex": "~0.8.4",
4848
"libp2p-pnet": "~0.1.0",
49-
"libp2p-secio": "~0.11.0",
49+
"libp2p-secio": "~0.11.1",
5050
"libp2p-spdy": "~0.13.1",
5151
"libp2p-tcp": "~0.13.0",
5252
"libp2p-webrtc-star": "~0.15.8",
53-
"libp2p-websockets": "~0.12.1",
53+
"libp2p-websockets": "~0.12.2",
5454
"peer-book": "~0.9.1",
5555
"portfinder": "^1.0.20",
56-
"sinon": "^7.2.0",
56+
"pull-length-prefixed": "^1.3.1",
57+
"pull-mplex": "~0.1.0",
58+
"pull-pair": "^1.1.0",
59+
"sinon": "^7.2.3",
5760
"webrtcsupport": "^2.2.0"
5861
},
5962
"dependencies": {
60-
"async": "^2.6.1",
61-
"bignumber.js": "^8.0.1",
63+
"async": "^2.6.2",
64+
"bignumber.js": "^8.0.2",
6265
"class-is": "^1.1.0",
6366
"debug": "^4.1.1",
6467
"err-code": "^1.1.2",
@@ -68,7 +71,7 @@
6871
"libp2p-circuit": "~0.3.4",
6972
"libp2p-identify": "~0.7.5",
7073
"moving-average": "^1.0.0",
71-
"multiaddr": "^6.0.3",
74+
"multiaddr": "^6.0.4",
7275
"multistream-select": "~0.14.4",
7376
"once": "^1.4.0",
7477
"peer-id": "~0.12.2",

src/connection/base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class BaseConnection extends EventEmitter {
2121
* @returns {void}
2222
*/
2323
close (err) {
24+
if (this._state._state === 'DISCONNECTING') return
2425
this.log(`closing connection to ${this.theirB58Id}`)
2526
if (err && this._events.error) {
2627
this.emit('error', err)

test/circuit-relay.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const parallel = require('async/parallel')
1212
const series = require('async/series')
1313
const TCP = require('libp2p-tcp')
1414
const WS = require('libp2p-websockets')
15-
const multiplex = require('libp2p-mplex')
15+
const multiplex = require('pull-mplex')
1616
const PeerBook = require('peer-book')
1717
const getPorts = require('portfinder').getPorts
1818

test/connection.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const WS = require('libp2p-websockets')
1111
const parallel = require('async/parallel')
1212
const secio = require('libp2p-secio')
1313
const pull = require('pull-stream')
14-
const multiplex = require('libp2p-mplex')
14+
const multiplex = require('pull-mplex')
1515
const spdy = require('libp2p-spdy')
1616
const Connection = require('interface-connection').Connection
1717
const Protector = require('libp2p-pnet')

test/dial-fsm.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const parallel = require('async/parallel')
1111
const WS = require('libp2p-websockets')
1212
const TCP = require('libp2p-tcp')
1313
const secio = require('libp2p-secio')
14-
const multiplex = require('libp2p-mplex')
14+
const multiplex = require('pull-mplex')
1515
const pull = require('pull-stream')
1616

1717
const utils = require('./utils')

test/pnet.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const expect = chai.expect
77
chai.use(dirtyChai)
88
const parallel = require('async/parallel')
99
const TCP = require('libp2p-tcp')
10-
const multiplex = require('libp2p-mplex')
10+
const multiplex = require('pull-mplex')
1111
const pull = require('pull-stream')
1212
const PeerBook = require('peer-book')
1313
const secio = require('libp2p-secio')

0 commit comments

Comments
 (0)