Library creation with testing

Hello,
I’m looking to create a library that will have Travis CI testing and hardware testing (I want to verify that it works). Is there currently a way to do this well? The requirements are:

  • The library must be importable in Web and Desktop IDE’s
  • Code should reside on GitHub
  • Unit testing with Travis CI (for all non-firmware related items)
  • Unit testing locally with photon/electron (I think I can use this: https://github.com/m-mcgowan/spark-unit-test)

The reason I ask is most (if not all) libraries out there have no testing. Some of the firmware code has testing, but there doesn’t seem to be an example library that shows how to perform test driven development with Particle.

1 Like

In the past I figured out how to use expect to build firmware using particle-cli, and po-util in Travis CI.

Here is the .travis.yml I used for building firmware in Travis CI:
https://github.com/nrobinson2000/sparkbot-default/blob/master/.travis.yml

I had to use this script to log into particle-cli:
https://github.com/nrobinson2000/sparkbot-default/blob/master/particle-cli-login.sh

You should be able to replicate my scripts to achieve Travis CI testing.