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

Commit fcb6bcc

Browse files
authoredSep 30, 2019
test: fix skips (#95)
The ephemeral port and host skips are no longer valid, so tests have been added for those. The other skipped test is now covered by the interface tests, so it's no longer needed. * chore: add node 12 to ci * chore: add docs and dist to gitignore * chore: clean up travis file
1 parent ce7bf4f commit fcb6bcc

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules
22
package-lock.json
33
coverage
44
.nyc_output
5+
docs
6+
dist

‎.travis.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
language: node_js
22
cache: npm
3+
sudo: false
4+
35
stages:
46
- check
57
- test
68
- cov
79

810
node_js:
911
- '10'
12+
- '12'
13+
14+
os:
15+
- linux
16+
- osx
17+
- windows
18+
19+
before_script:
20+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi
1021

1122
script: npx nyc -s npm run test:node -- --bail
1223
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
1324

1425
jobs:
1526
include:
16-
- os: linux
17-
sudo: false
18-
before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
19-
20-
- os: windows
21-
cache: false
22-
23-
- os: osx
24-
2527
- stage: check
2628
script:
2729
- npx aegir build --bundlesize
28-
- npx aegir dep-check -- -i wrtc -i electron-webrtc
30+
- npx aegir dep-check
2931
- npm run lint
3032

3133
- stage: test

‎test/node.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,24 @@ describe('listen', () => {
7575
await listener.close()
7676
})
7777

78-
it.skip('close listener with connections, through timeout', (done) => {
79-
// TODO `ws` closes all anyway, we need to make it not close
80-
// first - https://github.com/diasdavid/simple-websocket-server
81-
})
78+
it('listen on port 0', async () => {
79+
const ma = multiaddr('/ip4/127.0.0.1/tcp/0/ws/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
80+
const listener = ws.createListener((conn) => { })
8281

83-
it.skip('listen on port 0', (done) => {
84-
// TODO port 0 not supported yet
82+
await listener.listen(ma)
83+
const addrs = await listener.getAddrs()
84+
expect(addrs.map((a) => a.toOptions().port)).to.not.include(0)
85+
await listener.close()
8586
})
8687

87-
it.skip('listen on any Interface', (done) => {
88-
// TODO 0.0.0.0 not supported yet
88+
it('listen on any Interface', async () => {
89+
const ma = multiaddr('/ip4/0.0.0.0/tcp/0/ws/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
90+
const listener = ws.createListener((conn) => { })
91+
92+
await listener.listen(ma)
93+
const addrs = await listener.getAddrs()
94+
expect(addrs.map((a) => a.toOptions().host)).to.not.include('0.0.0.0')
95+
await listener.close()
8996
})
9097

9198
it('getAddrs', async () => {

0 commit comments

Comments
 (0)
This repository has been archived.