developer-grants icon indicating copy to clipboard operation
developer-grants copied to clipboard

OpenSource Maintenance: Flow JS Testing

Open MaxStalker opened this issue 2 years ago โ€ข 24 comments

Flow JS Testing

Grant category

  • Open source maintenance

Description

Flow JS Testing - https://github.com/onflow/flow-js-testing - is a set of utility functions, which allows developers to write tests using Javascript and Jest. You can easily deploy contracts, execute scripts, sign and send transactions.

I authored and brought this library to life and now I want to get it "back" and continue maintaining it ๐Ÿ˜ค

Target audience

  • New developers who learn their way around Cadence
  • Cadence developers who wants to use Javascript to write tests for a production grade project

Evidence for the need

  • โญ 46 stars, 30 forks
  • Official Kitty Items is using it - 215 forks
  • 20+ known projects using
  • 23 open issues in repository, some are breaking the pipelines for active projects ๐Ÿคทโ€โ™‚๏ธ
  • Active Discord channel flow-js-testing with multiple questions and challenges solved ๐Ÿ˜ค
  • +20,000 Total Downloads on npm (original and branded)

Proposed solution

I will apply my accrued knowledge to provide support for this library and it's dependencies ๐Ÿ˜

Impact

Javascript is still in Top-5 Programming languges used for web and blockchain development. Providing first-class support for Cadence testing with it will benefit those who will choose it and open possibilities for newcomers.

It's also much easier to teach someone how to test Cadence code if they are already using Javascript or Typescript to build their front-end part.

Milestones and funding

Milestone Deliverables Timeline Risks USD proposal
1 - New stable release New release supporting latest CLI, FCL-JS and emulator. Dependency testing suit to ensure stability ~4 weeks Current release is not stable enough to be used with latest CLI release 5,000
2 - Add Storage Query New methods and documentations how to query storage using latest changes in Cadence and emulator ~4 weeks No risk, but it's a really nice-to-have feature, which will enhance testing experience ๐Ÿ„โ€โ™‚๏ธ 5,000
3 - Setup CI/CD pipeline Set of Github Actions, which will track latest releases for all dependencies, run tests and raise an issue if some of them are failing and needs attention ~4 weeks Dependency release may easily break working pipeline 5,000
4 - Dev.to Articles 4 articles 4 weeks As I witnessed, documentation is often not enough to be able to use tools effectively 4,000
Maintenance Resolving issues and fixing bugs Every month for 3 months - 7,000 per month
Community Assistance Helping users resolve their issues and challenges via Discord and Github Every month for 3 months Developers who wouldn't get swift response might swap chains to get better support 3,000 per month

Team

Name Role Bio Contact
Max DevEx Engineer OG MaxStarka: Creator of flow-js-testing, flow-cadut and Playground extensions @MaxStalker

MaxStalker avatar Jan 26 '23 14:01 MaxStalker

My first choice testing library๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

LanfordCai avatar Jan 26 '23 14:01 LanfordCai

Testing is important

orodio avatar Jan 26 '23 14:01 orodio

We need this!

FelipeRibeiroLabs avatar Jan 26 '23 15:01 FelipeRibeiroLabs

+1 on everything!! :)

crash13override avatar Jan 26 '23 15:01 crash13override

I really look forward to having a stable flow testing JS framework. All are struggling with testing and most of them use JS. And current version has some issues when it comes to different versions of FCL, CLI (especially, the latest version)

What's more? We don't have enough materials / documents / articles / samples related to Cadence and Flow out there, thus, appreciate the idea about writing articles ๐Ÿ‘

Can't wait !!!!

salahawk avatar Jan 26 '23 16:01 salahawk

The more testing options the better.

bjartek avatar Jan 26 '23 17:01 bjartek

If you canโ€™t test it, I usually donโ€™t bother to write it. This is a must have.

C-3PFLO avatar Jan 26 '23 17:01 C-3PFLO

One last piece to complete the puzzle, is adding code coverage. A hint left from bluesign here: https://github.com/onflow/developer-grants/issues/113#issuecomment-1381793687, for another grant that is in review https://github.com/onflow/developer-grants/issues/132. It would be really awesome seeing the deliverable of one proposal, to empower another :pray:

m-Peter avatar Jan 26 '23 17:01 m-Peter

Great idea, @m-Peter ! ๐Ÿ’ฏ

MaxStalker avatar Jan 26 '23 17:01 MaxStalker

I think it could help a lot of people if it were made more robust, especially those who want to keep JS as their core tool for both their app and testing.

hichana avatar Jan 26 '23 22:01 hichana

We use flow-js-testing at The Fabricant, and one of the most frustrating parts of development for me at the moment is testing. fjs in its current state is incredibly temperamental, hinders our development process and erodes some of the incredible DevEx that Flow has worked so hard on.

A well maintained, active testing library that is kept up to date with CLI/Cadence releases is essential to seamless development. As Bjarte said, a variety of testing options is important for developers. I believe that many people in the community would agree that the product of this grant proposal would be hugely beneficial! Thanks @MaxStalker for putting this together!

ph0ph0 avatar Jan 27 '23 07:01 ph0ph0

Can only second ๐Ÿ’ฏ what was said before, would love to see Max being able to continue maintaining the great testing library which is much needed! ๐Ÿ‘

turbolent avatar Jan 27 '23 18:01 turbolent

Jumping in here to support this proposal and Max's continued work maintaining Flow JS Testing library

gregsantos avatar Jan 27 '23 19:01 gregsantos

Let's go! We will kickstart the process this week @MaxStalker. I'll reach out to you with details ๐Ÿ™Œ

fotescodev avatar Jan 30 '23 18:01 fotescodev

Thank you everyone for your support! ๐Ÿ™‡โ€โ™‚๏ธ

Looking forward to it. @fotescodev !

MaxStalker avatar Jan 30 '23 20:01 MaxStalker

Also voicing my support for @MaxStalker's proposal!

Max, I have some feedback that I'll put into some issues, but in general I think it'd be great if there was a way to access a lower-level API in flow-js-testing that makes it easier to use inside an existing testing library like Jest or Mocha.

psiemens avatar Jan 31 '23 19:01 psiemens

Thank you for your support and feedback, @psiemens !

I was experimenting with custom environment for Jest, which would provide emulator on "invisible" layer with no extra setup needed from user.

Also been playing with Bun - https://bun.sh/ - to provide faster JS runtime and test executions.

Future looking bright for this framework ๐Ÿ”ฎ๐Ÿ˜Š!

MaxStalker avatar Jan 31 '23 19:01 MaxStalker

I would love to see Max taking care of the js testing!! Probably he's one, if not the one, who better knows how it works, and always have been kindly enough to answer any question I may have about it.

alilloig avatar Jan 31 '23 23:01 alilloig

Awesome! Could we add either jsdoc annotations or typescript conversation as part of this as well?

justinbarry avatar Feb 02 '23 19:02 justinbarry

@justinbarry I annotated all of the exposed functionality with jsdoc format - here's example of sendTransaction function: https://github.com/onflow/flow-js-testing/blob/master/src/interaction.js#L112

But it's not preserved during bundling and package building. Maybe I am just "cooking" it wrong - would appreciate any help on that front ๐Ÿ™‡โ€โ™‚๏ธ

Typescript types are available here: https://www.npmjs.com/package/@types/onflow__flow-js-testing

Though should be part of the whole package - totally agree on that!

MaxStalker avatar Feb 02 '23 22:02 MaxStalker

You got all my support Max! I need Flow JS Testing so I can make YT videos on how to test :D

jacob-tucker avatar Feb 03 '23 01:02 jacob-tucker

Full support from here ๐Ÿ‘ This would really help JS devs to start building on Flow ๐Ÿš€

adbario avatar Feb 17 '23 22:02 adbario

Congratulations in getting the grant accepted @MaxStalker! Now let's get to work ๐Ÿš€

fotescodev avatar Feb 21 '23 18:02 fotescodev

Congrats, @MaxStalker

salahawk avatar Feb 22 '23 23:02 salahawk