mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-25 14:22:30 +00:00
Use dignified.js
This commit is contained in:
parent
b73406c983
commit
0ba1ca3aa8
3
.gitignore
vendored
3
.gitignore
vendored
@ -31,3 +31,6 @@ node_modules
|
|||||||
|
|
||||||
# Optional REPL history
|
# Optional REPL history
|
||||||
.node_repl_history
|
.node_repl_history
|
||||||
|
|
||||||
|
dist
|
||||||
|
lib
|
@ -1,13 +1,15 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "4.0"
|
- 4
|
||||||
|
- 5
|
||||||
|
|
||||||
# Make sure we have new NPM.
|
# Make sure we have new NPM.
|
||||||
before_install:
|
before_install:
|
||||||
- npm install -g npm
|
- npm install -g npm
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- npm run lint
|
||||||
- npm test
|
- npm test
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
|
21
gulpfile.js
Normal file
21
gulpfile.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const gulp = require('gulp')
|
||||||
|
const multiaddr = require('multiaddr')
|
||||||
|
const WSlibp2p = require('./src')
|
||||||
|
|
||||||
|
let ws
|
||||||
|
|
||||||
|
gulp.task('test:browser:before', (done) => {
|
||||||
|
ws = new WSlibp2p()
|
||||||
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
||||||
|
ws.createListener(mh, (socket) => {
|
||||||
|
socket.pipe(socket)
|
||||||
|
}, done)
|
||||||
|
})
|
||||||
|
|
||||||
|
gulp.task('test:browser:after', (done) => {
|
||||||
|
ws.close(done)
|
||||||
|
})
|
||||||
|
|
||||||
|
require('dignified.js/gulp')(gulp)
|
@ -1,39 +0,0 @@
|
|||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['mocha'],
|
|
||||||
|
|
||||||
files: [
|
|
||||||
'tests/browser-nodejs/browser.js'
|
|
||||||
],
|
|
||||||
|
|
||||||
preprocessors: {
|
|
||||||
'tests/*': ['webpack'],
|
|
||||||
'tests/browser-nodejs/*': ['webpack']
|
|
||||||
},
|
|
||||||
|
|
||||||
webpack: {
|
|
||||||
resolve: {
|
|
||||||
extensions: ['', '.js']
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
Buffer: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
webpackMiddleware: {
|
|
||||||
noInfo: true,
|
|
||||||
stats: {
|
|
||||||
colors: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
reporters: ['spec'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: false,
|
|
||||||
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
|
|
||||||
captureTimeout: 60000,
|
|
||||||
singleRun: true
|
|
||||||
})
|
|
||||||
}
|
|
32
package.json
32
package.json
@ -2,16 +2,15 @@
|
|||||||
"name": "libp2p-websockets",
|
"name": "libp2p-websockets",
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
"description": "JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec",
|
"description": "JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec",
|
||||||
"main": "src/index.js",
|
"main": "lib/index.js",
|
||||||
|
"jsnext:main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test:compliance:connection": "node tests/connection.js",
|
"lint": "dignified-lint",
|
||||||
"test:compliance:transport": "node tests/transport.js",
|
"test": "gulp test",
|
||||||
"test:specific": "mocha tests/*-test.js",
|
"test:node": "gulp test:node",
|
||||||
"test:node": "npm run test:specific",
|
"test:browser": "gulp test:browser",
|
||||||
"test:browser": "node tests/browser-nodejs/test.js",
|
"build": "dignified-build",
|
||||||
"test": "npm run test:node && npm run test:browser",
|
"release": "dignified-release"
|
||||||
"test-2": "npm run test:specific && npm run test:compliance:transport && npm run test:compliance:connection",
|
|
||||||
"lint": "standard"
|
|
||||||
},
|
},
|
||||||
"pre-commit": [
|
"pre-commit": [
|
||||||
"lint",
|
"lint",
|
||||||
@ -37,19 +36,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
|
"dignified.js": "github:dignifiedquire/dignified.js",
|
||||||
|
"gulp": "^3.9.1",
|
||||||
"interface-connection": "0.0.3",
|
"interface-connection": "0.0.3",
|
||||||
"interface-transport": "^0.1.1",
|
"interface-transport": "^0.1.1",
|
||||||
"istanbul": "^0.4.2",
|
"pre-commit": "^1.1.2"
|
||||||
"karma": "^0.13.22",
|
|
||||||
"karma-chrome-launcher": "^0.2.2",
|
|
||||||
"karma-firefox-launcher": "^0.1.7",
|
|
||||||
"karma-mocha": "^0.2.2",
|
|
||||||
"karma-spec-reporter": "0.0.24",
|
|
||||||
"karma-webpack": "^1.7.0",
|
|
||||||
"mocha": "^2.4.5",
|
|
||||||
"pre-commit": "^1.1.2",
|
|
||||||
"standard": "^6.0.7",
|
|
||||||
"tape": "^4.2.0",
|
|
||||||
"webpack": "^2.1.0-beta.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
// const debug = require('debug')
|
// const debug = require('debug')
|
||||||
// const log = debug('libp2p:tcp')
|
// const log = debug('libp2p:tcp')
|
||||||
const SWS = require('simple-websocket')
|
const SWS = require('simple-websocket')
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict'
|
|
||||||
/* eslint-env mocha */
|
/* eslint-env mocha */
|
||||||
|
'use strict'
|
||||||
|
|
||||||
const expect = require('chai').expect
|
const expect = require('chai').expect
|
||||||
const WSlibp2p = require('../../src')
|
|
||||||
const multiaddr = require('multiaddr')
|
const multiaddr = require('multiaddr')
|
||||||
|
const WSlibp2p = require('../src')
|
||||||
|
|
||||||
describe('libp2p-websockets', function () {
|
describe('libp2p-websockets', function () {
|
||||||
this.timeout(10000)
|
this.timeout(10000)
|
@ -1,8 +1,9 @@
|
|||||||
/* eslint-env mocha */
|
/* eslint-env mocha */
|
||||||
|
'use strict'
|
||||||
|
|
||||||
const expect = require('chai').expect
|
const expect = require('chai').expect
|
||||||
const WSlibp2p = require('../src')
|
|
||||||
const multiaddr = require('multiaddr')
|
const multiaddr = require('multiaddr')
|
||||||
|
const WSlibp2p = require('../src')
|
||||||
|
|
||||||
describe('libp2p-websockets', function () {
|
describe('libp2p-websockets', function () {
|
||||||
this.timeout(10000)
|
this.timeout(10000)
|
@ -1,28 +0,0 @@
|
|||||||
const Server = require('karma').Server
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const WSlibp2p = require('../../src')
|
|
||||||
const multiaddr = require('multiaddr')
|
|
||||||
|
|
||||||
var ws
|
|
||||||
|
|
||||||
function createListener (done) {
|
|
||||||
ws = new WSlibp2p()
|
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
|
||||||
ws.createListener(mh, (socket) => {
|
|
||||||
socket.pipe(socket)
|
|
||||||
}, done)
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopServer (done) {
|
|
||||||
ws.close(done)
|
|
||||||
}
|
|
||||||
|
|
||||||
function run (done) {
|
|
||||||
new Server({
|
|
||||||
configFile: path.join(__dirname, '/../../karma.conf.js'),
|
|
||||||
singleRun: true
|
|
||||||
}, done).start()
|
|
||||||
}
|
|
||||||
|
|
||||||
createListener(() => run((exitCode) => stopServer(() => process.exit(exitCode))))
|
|
Loading…
x
Reference in New Issue
Block a user