CLI

Getting started

To get started, globally install the debugbear Node module and generate an API key. You'll also need to know the ID of the page you want to analyze.

Read more about getting set up.

Running a normal analysis on the monitored page

The command below will analyze the page and show it in the normal results view.

DEBUGBEAR_API_KEY=... debugbear --pageId=... --waitForResult

The output will look like this:

Repo: not specified
Commit: not specified
When the result is ready you can see it here: https://www.debugbear.com/viewResult/12345678
Waiting for result
Analysis complete

Running analyses in CI

To run DebugBear as part of CI you either need to deploy the CI build to a public server or use a tool like ngrok to make the local server accessible.

If you pass in the --commitHash option your analysis build will not show up as part of the daily monitoring results. Instead you can see a comparison between the new build and a base build.

The base build is either the latest daily monitoring result, or the latest build on a base branch, if --baseBranch is passed into the CLI and a build on that branch is available.

debugbear \ 
  --pageId=... \
  --commitHash=fd9aed3 \
  --commitBranch=my-feature-branch \
  --buildTitle="Commit message" \
  --baseBranch=master \
  http://deployed-branch.example.com

Where possible these CLI options are inferred using env-ci, so you usually don't need to pass in --commitHash, --commitBranch, or --buildTitle.

Running analyses in CI with ngrok

If you aren't deploying your build to a staging server you can use your CI environment as one. You can use ngrok to expose your CI environment publicly.

When running debugbear, pass in the --ngrokWebPort=4040 option. This lets DebugBear find out the domain name of your server. The pathname will be take from the monitored page, or you can use --path=/somewhere to overrride it.

Make sure to also pass in --waitForResult to keep your CLI server up until the analysis has finished.

You can read a more detailed how-to guide here.

CLI options

This is the full list of available CLI options.

Option Name Description
...url Override the URL that's analyzed
--pageId Which of the pages in your project the analzyed page belongs to
--waitForResult Don't exit CLI command until the analysis has finished
--commitHash Hash of the commit being built, used for build comparison and Github integration
--commitBranch Branch that's being built, used for build comparison and Github integration
--buildTitle Name of the build, defaults to the git commit message
--baseBranch Branch to compare the commit to, usually something like master or develop
--baseHash Commit hash to compare the commit to
--repoOwner Used for Github integration, username or organization that owns the repo
--repoName Used for Github integration, name of the git repo
--ngrokWebPort Port for the ngrok admin interface, usually 4040
--path Pathname of the page if different than what the --pageId page uses

Still need help? Contact matt@debugbear.com for support.
© 2019 DebugBear Ltd