Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

chore: consistent browser examples #3204

Merged
merged 3 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions examples/test-ipfs-example/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,19 @@ testExample(dir)
})

async function testExample (dir) {
//await installDeps(dir)
await build(dir)

if (dir.includes('examples/browser-')) {
await runBrowserTest(dir)
const test = require(path.join(dir, 'test.js'))

if (typeof test === 'function') {
console.info('Running tests in', dir)

await test()
} else {
await runNodeTest(dir)
await runBrowserTest(dir)
}

process.exit(0)
}

async function build (dir) {
Expand Down Expand Up @@ -92,13 +97,3 @@ async function runBrowserTest (dir) {
server.stop()
}
}

async function runNodeTest (dir) {
console.info('Running node tests in', dir)

const runTest = require(path.join(dir, 'test.js'))

await runTest()

process.exit(0)
}