tfjs-react-native/DEVELOPMENT.md
This file will document some of the differences from the regular development workflow in DEVELOPMENT.md. You should read that document first to get familiar with typical TensorFlow.js development workflow.
Development and testing for tfjs-react-native is somewhat different from the packages like tfjs-core or tfjs-layers for a few reasons:
These are a few key terms/technologies to be familiar with that are different from what we use for web or node.js development.
imports/requires are statically resolved. So you cannot exclude a require with a conditional in JS code.require's of certain node libraries that are not present in react native, files that do that need to be excluded from the metro build process. For end users, this is documented in the README, but it also happens in integration_rn59/prep_tests.ts.There are three categories of tests that are run for this package.
Unit tests are written for the package functionality and are imported into a react native application to run on device. They are run together with the integration tests described below to simplify automation.
Unit tests from tfjs-core are imported into a react native application and run as integration tests. This allows testing of tfjs-core against actual devices through the RN bridge and against expo's WebGL bindings.
Because these are part of an app to run them you must compile and run the integration_rn59 of the target device. There is a button in that app to start the unit tests.
This is automated in CI and runs on:
integration_rn59/package.jsonThe integration_rn59 app also contains some other tests and sanity checks. These can be run manually. Future on device integration tests should also be incorporated into this app.
Integration tests on CI have a few moving pieces, the basic workflow is as follows.
apk run yarn update-api. This will update what is stored on GCP and also sync it to Browserstack.