npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-ble-plx-mock-recorder

v0.0.6

Published

Mock recorder and playback tool for react-native-ble-plx

Downloads

489

Readme

react-native-ble-plx-mock-recorder

Build Status

Mock recorder and playback tool for react-native-ble-plx. Enables fast and robust integration tests for your Bluetooth/BLE app.

Overview

This tool will help developers of React Native apps that talk to Bluetooth/BLE devices. Avoid having a lot of slow and fragile end-to-end tests taking more than an hour to run on physical devices and a physical CI server!

If you can run your UI tests with pre-recorded BLE traffic, you get very fast and robust tests, that are actual integration tests, since you are not writing your mocks by hand.

You will create a separate mock recorder app, using the "react-native-ble-plx-mock-recorder-mocha-template" template for React Native to occasionally record actual traffic needed by your tests.

Then use this library to play back the BLE traffic every time you run your Jest UI tests, and enjoy the speed of up to 100 of tests per second.

For more information, check out the blog post.

Prerequisites

  • A Bluetooth/BLE device, powered on, nearby, not connected to a phone.
  • A React Native app talking to the BLE device.
  • An Android phone, plugged into your computer.
    • (Support for iPhone is planned).
  • A React Native development environment: https://reactnative.dev/docs/environment-setup.
  • bash on your path.
    • If on Windows, consider using Git Bash (https://gitforwindows.org/).

Demo

npm install
npm run demo:app
# then close the app and the Metro popup terminal window
npm run demo:recorder
# from here on you can unplug phone and power down BLE device
npm run demo:app:test

Getting started

To get started, read how to build your own demo from scratch. Then apply the same steps to the app you would like to test.

API

TODO

Architecture

See ARCHITECTURE.md

Limitations

Currently a large part of the central API of react-native-ble-plx is implemented, but several methods which have not been needed yet, are missing. They should be easy to add. Feel free to submit a Pull Request!

Contributing

Contributions are welcome! Please open an issue with your suggestions and/or submit a PR. PRs should pass npm test and not decrease code coverage.

Contributors

| | | | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @larsthorup @larsthorup | @muscapades @muscapades |

Publish to npm

# git commit && git push
# wait for CI to pass
# clean workspace
git checkout main
git pull
npm run test:e2e
npm run bump
npm run publish
# git commit && git push

Then manually verify local react-native-ble-plx-mock-recorder-mocha-template and publish that.