mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 17:21:21 +00:00
docs: auto relay example (#795)
* chore: auto relay example * chore: update examples to use process arguments * chore: add test setup for node tests and test for auto-relay * chore: apply suggestions from code review * chore: do not use promise for multiaddrs event on example
This commit is contained in:
committed by
Vasco Santos
parent
585ad52b4c
commit
4448de8432
33
examples/test-all.js
Normal file
33
examples/test-all.js
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict'
|
||||
|
||||
process.on('unhandedRejection', (err) => {
|
||||
console.error(err)
|
||||
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const {
|
||||
waitForOutput
|
||||
} = require('./utils')
|
||||
|
||||
async function testAll () {
|
||||
for (const dir of fs.readdirSync(__dirname)) {
|
||||
if (dir === 'node_modules' || dir === 'tests_output') {
|
||||
continue
|
||||
}
|
||||
|
||||
const stats = fs.statSync(path.join(__dirname, dir))
|
||||
|
||||
if (!stats.isDirectory()) {
|
||||
continue
|
||||
}
|
||||
|
||||
await waitForOutput('npm info ok', 'npm', ['test', '--', dir], {
|
||||
cwd: __dirname
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
testAll()
|
Reference in New Issue
Block a user