mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-25 12:02:21 +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
|
||||
.node_repl_history
|
||||
|
||||
dist
|
||||
lib
|
@ -1,13 +1,15 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.0"
|
||||
- 4
|
||||
- 5
|
||||
|
||||
# Make sure we have new NPM.
|
||||
before_install:
|
||||
- npm install -g npm
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
|
||||
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",
|
||||
"version": "0.2.1",
|
||||
"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": {
|
||||
"test:compliance:connection": "node tests/connection.js",
|
||||
"test:compliance:transport": "node tests/transport.js",
|
||||
"test:specific": "mocha tests/*-test.js",
|
||||
"test:node": "npm run test:specific",
|
||||
"test:browser": "node tests/browser-nodejs/test.js",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test-2": "npm run test:specific && npm run test:compliance:transport && npm run test:compliance:connection",
|
||||
"lint": "standard"
|
||||
"lint": "dignified-lint",
|
||||
"test": "gulp test",
|
||||
"test:node": "gulp test:node",
|
||||
"test:browser": "gulp test:browser",
|
||||
"build": "dignified-build",
|
||||
"release": "dignified-release"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
@ -37,19 +36,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"dignified.js": "github:dignifiedquire/dignified.js",
|
||||
"gulp": "^3.9.1",
|
||||
"interface-connection": "0.0.3",
|
||||
"interface-transport": "^0.1.1",
|
||||
"istanbul": "^0.4.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"
|
||||
"pre-commit": "^1.1.2"
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
// const debug = require('debug')
|
||||
// const log = debug('libp2p:tcp')
|
||||
const SWS = require('simple-websocket')
|
||||
|
@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const expect = require('chai').expect
|
||||
const WSlibp2p = require('../../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
const WSlibp2p = require('../src')
|
||||
|
||||
describe('libp2p-websockets', function () {
|
||||
this.timeout(10000)
|
@ -1,8 +1,9 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const expect = require('chai').expect
|
||||
const WSlibp2p = require('../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
const WSlibp2p = require('../src')
|
||||
|
||||
describe('libp2p-websockets', function () {
|
||||
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