Skip to content

Latest commit

 

History

History
155 lines (108 loc) · 3.8 KB

File metadata and controls

155 lines (108 loc) · 3.8 KB

Testing the BugSnag CLI

Initial setup

Clone the repository and navigate to the project directory:

git clone git@github.com:bugsnag/bugsnag-cli.git
cd bugsnag-cli

Prerequisites

  • Go — Install via Homebrew or from go.dev:
    brew install golang
  • Ruby & Bundler — Required for end-to-end tests:
    gem install bundler
    bundle install
  • Node.js & npm — Required for npm linting and JavaScript fixture builds.

Building the CLI

Build for the host platform:

make build

Build for all platforms (Windows, Linux, macOS):

make build-all

Unit tests

Unit tests are written in Go and live under the test/ directory, covering:

  • android/ — AAB manifest parsing, DEX build IDs, NDK paths/versions, objcopy, variant listing
  • endpoints/ — Endpoint configuration
  • ios/ — Plist parsing
  • options/ — Build metadata creation
  • upload/ — Android manifest, Android NDK, Breakpad, Dart, and JS uploads
  • utils/ — dSYM handling, file utilities, gzip compression

Run all unit tests:

make unit-test

This executes go test -race ./test/... with output formatted via gotestfmt.

Linting

Go

make go-lint

Runs golangci-lint across the codebase.

Go formatting

make fmt

Applies gofmt to all Go source files.

npm

make npm-lint

Runs npm-check against the js/ package to detect outdated or unused dependencies.

End-to-end tests

End-to-end tests use Bugsnag Maze Runner with feature files under features/. Step definitions are in features/steps/steps.rb.

Test categories

Category Feature files Description
CLI features/cli/ General CLI behaviour, create-build, --exclude, installation
Android features/android/ AAB, NDK, and ProGuard uploads
Xcode / dSYM features/xcode/ dSYM uploads, Xcode build/archive, Swift Package Manager
JavaScript features/js/ Source map uploads (Webpack 4 & 5, nested maps)
Dart features/dart/ Dart symbol uploads
React Native features/react-native/ Android & iOS React Native uploads
Node.js features/node/ Node.js source map uploads
Unity features/unity/ Android & iOS Unity uploads
Breakpad features/breakpad/ Breakpad symbol uploads

Running end-to-end tests

Ensure the CLI is built first (make build), then run a specific category:

bundle exec maze-runner features/<category>

For example:

bundle exec maze-runner features/cli
bundle exec maze-runner features/xcode
bundle exec maze-runner features/android

Maze Runner port

The feature files reference $MAZE_RUNNER_PORT in upload/build API URLs. This defaults to 9339 if not set. To use a different port, export the variable before running tests:

export MAZE_RUNNER_PORT=9340
bundle exec maze-runner features/cli

Building test fixtures

Some end-to-end tests require pre-built fixtures. Build them with:

make test-fixtures

Individual fixtures can also be built separately:

make features/base-fixtures/android       # Requires Android SDK / Gradle
make features/base-fixtures/dart          # Requires Flutter SDK
make features/base-fixtures/dsym          # Requires Xcode
make features/base-fixtures/js-webpack4   # Requires Node.js
make features/base-fixtures/js-webpack5   # Requires Node.js

CI

The project uses Buildkite for continuous integration. The pipeline (.buildkite/pipeline.yml) runs:

  1. License audit
  2. Build
  3. Go and npm linting
  4. Unit tests
  5. End-to-end tests across all categories

CI runs on macOS agents. Unity tests use isolated macOS agents.