mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-03-16 13:50:55 +00:00
Clean up browser + nodejs tests
This commit is contained in:
parent
ce62196bd9
commit
138c82e2ca
@ -4,11 +4,12 @@ module.exports = function (config) {
|
||||
frameworks: ['mocha'],
|
||||
|
||||
files: [
|
||||
'tests/browser.js'
|
||||
'tests/browser-nodejs/browser.js'
|
||||
],
|
||||
|
||||
preprocessors: {
|
||||
'tests/*': ['webpack']
|
||||
'tests/*': ['webpack'],
|
||||
'tests/browser-nodejs/*': ['webpack']
|
||||
},
|
||||
|
||||
webpack: {
|
||||
|
@ -8,7 +8,7 @@
|
||||
"test:compliance:transport": "node tests/transport.js",
|
||||
"test:specific": "mocha tests/*-test.js",
|
||||
"test:node": "npm run test:specific",
|
||||
"test:browser": "node tests/karma",
|
||||
"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"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-env mocha */
|
||||
|
||||
const expect = require('chai').expect
|
||||
const WSlibp2p = require('../src')
|
||||
const WSlibp2p = require('../../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
|
||||
describe('libp2p-websockets', function () {
|
@ -1,12 +1,12 @@
|
||||
const Server = require('karma').Server
|
||||
const path = require('path')
|
||||
|
||||
const WSlibp2p = require('../src')
|
||||
const WSlibp2p = require('../../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
|
||||
var ws
|
||||
|
||||
function createServer (done) {
|
||||
function createListener (done) {
|
||||
ws = new WSlibp2p()
|
||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
||||
ws.createListener(mh, (socket) => {
|
||||
@ -18,11 +18,11 @@ function stopServer (done) {
|
||||
ws.close(done)
|
||||
}
|
||||
|
||||
function runTests (done) {
|
||||
function run (done) {
|
||||
new Server({
|
||||
configFile: path.join(__dirname, '/../karma.conf.js'),
|
||||
configFile: path.join(__dirname, '/../../karma.conf.js'),
|
||||
singleRun: true
|
||||
}, done).start()
|
||||
}
|
||||
|
||||
createServer(() => runTests(() => stopServer(() => null)))
|
||||
createListener(() => run((exitCode) => stopServer(() => process.exit(exitCode))))
|
Loading…
x
Reference in New Issue
Block a user