Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Conversation

@aphelionz
Copy link
Contributor

@aphelionz aphelionz commented Aug 30, 2020

This PR starts us off towards browser support by migrating core functionality from cli.js to index.js. It's a WIP still but I think it's good enough to take out of draft. See the "What's left" section below for a start of what should be done before approval.

What it does:

  • Adds a single benchmark to the benchmarks folder in the repo that just calles new Date()
  • Moves start, runOne and getElapsed to index.js
  • Alters the signature of start but then applies that signature at the call site in cli.js so that nothing should functionally change
  • Wraps the cli.js in if (require.main == module) so that simply requiring it doesn't run the benchmarks automatically
  • Moves a lot of the previously-global constant declarations inside the start function
  • Adds a number of tests to test/cli.test.js that run the start function

This gives us near 100% test coverage 🎉 and also paves the way for building with webpack et al and doing some browser benchmarking

These PRs should be merged first!

What's left:

  • Actually capture and check the outputs of the new tests to ensure they're actually doing what they're supposed to be doing instead of just calling await start and being happy that there were no errors
  • Put output back but perhaps consider console.log or something so there's nothing node.js-specific in index.js (should all be captured in cli.js and perhaps an upcoming browser.js)

(Above moved to new issues)

Fixes #15

@aphelionz aphelionz requested a review from mistakia August 30, 2020 21:07
@aphelionz aphelionz marked this pull request as ready for review August 30, 2020 21:28
WIP

refactor: move core functionality to index.js

suppressing output for CI

adding back in missing return statement

removing stray console.log

putting output back, sorry CI

rename IPFS log to OrbitDB

Removing rimraf

moving files to src

moving report and benchmarks folder

Adding global gc to index.js

linting
@aphelionz aphelionz merged commit cfd5d6e into master Jan 20, 2021
@aphelionz aphelionz deleted the refactor/index-js branch January 20, 2021 22:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

increase code coverage

3 participants