@testsnag/cli
v0.1.7
Published
Upload a mobile build, point tests at it, and run them.
Maintainers
Readme
TestSnag CLI
Upload a mobile build, point tests at it, and run them.
npx @testsnag/cliGetting started
Create a token in your workspace settings, under API tokens, then:
npx @testsnag/cli loginThe token is stored in ~/.testsnag/config.json. In CI, set TESTSNAG_TOKEN instead and skip the login step.
Commands
| Command | What it does |
| -------- | ---------------------------------------------- |
| login | Store an API token and the installation URL |
| run | Trigger tests that already have a build |
| update | Upload a build, bind it to tests, and run them |
Run with no command to pick interactively.
Options
| Flag | Meaning |
| ------------------- | ------------------------------------------------------------- |
| --test <id\|name> | The test id, or its full name. Repeat the flag for each test. |
| --build <path> | The build file to upload |
| --run | Run the tests after updating |
| --wait | Block until runs finish, exit non-zero on failure |
| --token <token> | Overrides TESTSNAG_TOKEN |
| --url <url> | The TestSnag installation |
| --json | Machine readable output, implies non-interactive |
In CI
Supply every input as a flag and there is no prompt, so it runs without a TTY:
TESTSNAG_TOKEN=$TESTSNAG_TOKEN npx @testsnag/cli update \
--build ./android/app/build/outputs/apk/release/app-release.apk \
--test "Checkout smoke" --test "Sign up" \
--run --wait --jsonThe exit code is non-zero when a run fails, so the pipeline stops.
Builds
iOS takes a zipped simulator build (.zip, .tar.gz, .tgz), produced with xcodebuild -sdk iphonesimulator. Android takes an
.apk or .apks.
An .ipa or an .aab can be uploaded and stored, but not bound to a test: an .ipa is built for device hardware and a simulator
cannot run it, and an .aab is not installable until bundletool build-apks --mode=universal converts it.
Interactively, the CLI lists build artifacts it finds in the working directory and the usual output directories, newest first. That
covers Gradle and Xcode as well as Flutter (build/app/outputs/flutter-apk, build/ios/iphonesimulator) and React Native
(ios/build/Build/Products/Debug-iphonesimulator).
To upload a build without pointing any test at it, choose Just upload it when asked, or pass --no-bind. The file lands in
your Files library, ready to bind later.
Development
npm test
npm run formatNo build step, no TypeScript. Node 20 or newer.
