# Install

Use Testlight to run `.mmt` files from a terminal or CI pipeline. The npm package is `mmt-testlight`; the command you run is `testlight` (and `mmt`, depending on how you install).

## npm

Global install:

```sh
npm install -g mmt-testlight
```

Or run without a global install:

```sh
npx mmt-testlight run path/to/test.mmt
```

Quick try with the repo examples:

```sh
npx testlight run examples/basic/02_simple_test/echo_test.mmt --quiet
```

## Pre-release vs stable

One version number is shared by Testlight, the VS Code extension, and the GitHub Action. The **tag** decides the channel:

| Tag | Channel | What you get |
|---|---|---|
| `v1.41.2` | stable | npm `@latest`, Docker `:latest`, Marketplace stable, GitHub latest |
| `v1.41.2-pre` | pre-release | npm `@pre`, Docker `:pre`, Marketplace `1.41.2` pre-release, GitHub prerelease |

Default installs stay on stable. Opt in to pre-release:

```sh
npm install -g mmt-testlight@pre
docker pull mshobeyri/mmt-testlight:pre
CHANNEL=pre curl -fsSL https://raw.githubusercontent.com/mshobeyri/multimeter/main/scripts/install-testlight.sh | bash
```

In VS Code, use **Switch to Pre-Release Version**. Homebrew stays on the last stable.

## GitHub Action

Try it first on [testlight-action](https://github.com/mshobeyri/testlight-action): **Actions → CI → Run workflow**. On a fork, enable Actions once, then run the same way.

```yaml
- uses: actions/checkout@v6
- uses: mshobeyri/testlight-action@v1
  with:
    file: tests/suite.mmt
    report: junit
    report-file: results/junit.xml
```

See the [action README](https://github.com/mshobeyri/testlight-action).

## Azure Pipelines

Install the Testlight Azure Pipelines extension on the org, then use `Testlight@1` (same inputs as the GitHub Action `with:` block, as YAML `inputs:`):

```yaml
- task: Testlight@1
  inputs:
    file: tests/suite.mmt
    report: junit
    reportFile: results/junit.xml
```

Source and packaging live in `mmtazure/` in this repo. Full pipeline copy-paste: [Run in CI](../../tasks/run-in-ci.md#azure-pipelines).

## macOS (Homebrew)

```sh
brew tap mshobeyri/multimeter
brew install mmt-testlight
```

## Other platforms

Linux, Windows, and Docker installs are listed on the [Downloads](/downloads) page.

## Standalone binary (CI)

For pipelines, use a self-contained binary built with `@yao-pkg/pkg` (SEA / Node 22, Brotli-compressed archive) — no Node.js required on the runner.

Build locally from the repo (Node ≥ 22):

```sh
cd mmtcli
npm install
npm run pkg
```

Binaries land under `bin/<platform>/` at the repo root (for example
`bin/macos-arm64/testlight`, `bin/linux-x64/testlight`,
`bin/win-x64/testlight.exe`). Upload the platform folder or the GitHub Release
archive to your artifact store and invoke it in CI:

```sh
# macOS (Apple Silicon)
./bin/macos-arm64/testlight run path/to/test.mmt --quiet

# Linux
./bin/linux-x64/testlight run path/to/test.mmt --quiet
```

## Update standalone / portal binaries

If you installed the GitHub Release binary (or a portal copy of it), refresh it in place:

```sh
testlight update              # latest stable from GitHub Releases
testlight update --check      # print whether an update is available
testlight update --to 1.38.1
testlight update --channel beta
```

npm installs should use npm instead (`testlight update` prints the command):

```sh
npm install -g mmt-testlight@latest
```

Homebrew:

```sh
brew upgrade mmt-testlight
```

### Private portal / mirror

Host the same asset names under a versioned prefix and point the CLI at it:

```sh
export TESTLIGHT_RELEASE_BASE_URL=https://portal.example/artifacts/testlight
# expects: $TESTLIGHT_RELEASE_BASE_URL/v1.38.1/testlight-linux-x64.tar.gz
testlight update --to 1.38.1
```

Optional: `TESTLIGHT_REPO=owner/name` to resolve “latest” from another GitHub repo’s releases.

See also: [Commands](./commands.md) · [Examples](./examples.md) · [Run in CI](../../tasks/run-in-ci.md)
