mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-25 08:22:24 +00:00
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
This commit is contained in:
parent
ce7bf4f1e0
commit
fcb6bcc378
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
coverage
|
coverage
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
docs
|
||||||
|
dist
|
||||||
|
22
.travis.yml
22
.travis.yml
@ -1,5 +1,7 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
cache: npm
|
cache: npm
|
||||||
|
sudo: false
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- check
|
- check
|
||||||
- test
|
- test
|
||||||
@ -7,25 +9,25 @@ stages:
|
|||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- '10'
|
- '10'
|
||||||
|
- '12'
|
||||||
|
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
- windows
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi
|
||||||
|
|
||||||
script: npx nyc -s npm run test:node -- --bail
|
script: npx nyc -s npm run test:node -- --bail
|
||||||
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
|
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
|
||||||
sudo: false
|
|
||||||
before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
|
|
||||||
|
|
||||||
- os: windows
|
|
||||||
cache: false
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
|
|
||||||
- stage: check
|
- stage: check
|
||||||
script:
|
script:
|
||||||
- npx aegir build --bundlesize
|
- npx aegir build --bundlesize
|
||||||
- npx aegir dep-check -- -i wrtc -i electron-webrtc
|
- npx aegir dep-check
|
||||||
- npm run lint
|
- npm run lint
|
||||||
|
|
||||||
- stage: test
|
- stage: test
|
||||||
|
23
test/node.js
23
test/node.js
@ -75,17 +75,24 @@ describe('listen', () => {
|
|||||||
await listener.close()
|
await listener.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('close listener with connections, through timeout', (done) => {
|
it('listen on port 0', async () => {
|
||||||
// TODO `ws` closes all anyway, we need to make it not close
|
const ma = multiaddr('/ip4/127.0.0.1/tcp/0/ws/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||||
// first - https://github.com/diasdavid/simple-websocket-server
|
const listener = ws.createListener((conn) => { })
|
||||||
|
|
||||||
|
await listener.listen(ma)
|
||||||
|
const addrs = await listener.getAddrs()
|
||||||
|
expect(addrs.map((a) => a.toOptions().port)).to.not.include(0)
|
||||||
|
await listener.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('listen on port 0', (done) => {
|
it('listen on any Interface', async () => {
|
||||||
// TODO port 0 not supported yet
|
const ma = multiaddr('/ip4/0.0.0.0/tcp/0/ws/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||||
})
|
const listener = ws.createListener((conn) => { })
|
||||||
|
|
||||||
it.skip('listen on any Interface', (done) => {
|
await listener.listen(ma)
|
||||||
// TODO 0.0.0.0 not supported yet
|
const addrs = await listener.getAddrs()
|
||||||
|
expect(addrs.map((a) => a.toOptions().host)).to.not.include('0.0.0.0')
|
||||||
|
await listener.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('getAddrs', async () => {
|
it('getAddrs', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user