Skip to main content

Installation

Prerequisites

You need at least Node.js v12 to install and run Betterer.

Adding Betterer to your project

The easiest way to get up and running with Betterer is to use the init script via npx:

# Run this from the root of your project:
npx @betterer/cli init

Running this command will:

  1. Add @betterer/cli as a devDependency to your package.json
  2. Add a betterer script to your package.json
  3. Create a blank .betterer.ts file in the root of your project
caution

Running npx @betterer/cli init will modify your project's package.json file, so you probably want to make sure all your changes are saved first!

Init Options

You can pass the following options to the init script:

OptionDescriptionDefault
--automergeEnable automatic merging for the Betterer results filefalse
-c, --config [path]Path to test definition file relative to CWD./.betterer.ts
-r, --results [value]Path to test results file relative to CWD./.betterer.results
info

Betterer uses TypeScript by default! If you pass a --config path that ends with .js, JavaScript will be used instead and TypeScript will not be installed.

Read more about Init

Installing Betterer dependencies

You'll need to install the new dependency with your package manager of choice:

Run yarn to install @betterer/cli

That's it!

You're all ready to go! 🎉