# @mizdra/eco-backstopjs-runner

> Eco-friendly Backstop.js runner.

Latest version **0.0.6** (published 2022-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mizdra/eco-backstopjs-runner
pnpm add @mizdra/eco-backstopjs-runner
yarn add @mizdra/eco-backstopjs-runner
bun add @mizdra/eco-backstopjs-runner
```

Provides the command `eco-backstop`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-04-17 |
| First published | 2022-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 2 |
| Unpacked size | 35.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mizdra |
| Maintainers | mizdra |
| Keywords | eslint |

## Links

- npm: https://www.npmjs.com/package/@mizdra/eco-backstopjs-runner
- Repository: https://github.com/mizdra/backstopjs-playground
- Homepage: https://github.com/mizdra/backstopjs-playground#readme
- Issues: https://github.com/mizdra/backstopjs-playground/issues
- npm.io page: https://npm.io/package/@mizdra/eco-backstopjs-runner

## Dependencies (2)

- [yargs](https://npm.io/package/yargs.md) ^17.4.1
- [import-cwd](https://npm.io/package/import-cwd.md) ^3.0.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2022-04-17
- 0.0.5 — 2022-04-11
- 0.0.4 — 2022-04-11
- 0.0.3 — 2022-04-11
- 0.0.2 — 2022-04-10
- 0.0.1 — 2022-04-10

## README

# @mizdra/eco-backstopjs-runner

実行時間が最小になるよう設計された Backstop.js カスタムランナーです。

## Target users

- `referenceUrl` を使い、異なる環境同士のビジュアルリグレッションテストを実行しているユーザー

## How it works

このカスタムランナーは以下のように動作します。

1. 全シナリオに対して、`backstop test` を実行する
2. ステップ 1 で failed になったシナリオに対して、 `backstop reference` でリファレンスを再作成
3. ステップ 1 で failed になったシナリオに対して、再度 `backstop test` を実行する
4. HTML レポートを作成
   - ステップ 1 で passed なシナリオは passed としてレポートに記録されます
   - ステップ 1 では failed、ステップ 3 では passed なシナリオは passed としてレポートに記録されます
   - ステップ 1 では failed、ステップ 3 でも failed なシナリオは failed としてレポートに記録されます
5. 実行を終了する
   - レポートに failed なシナリオが 1 つでも記録されていれば、exit code 1 で、1 つもなければ exit code 0 で終了します

この挙動により、以下のようなメリットが得られます。

- 新規にシナリオを追加する際に、手動での reference の生成が不要になります
  - まだ reference のないシナリオがあっても、一度 reference を作成した上で test が実行されるためです
  - 自動生成された reference をリポジトリに commit するような CI を組めば、手動で reference を作成・commit する手間を省けます
- reference が古くなっている場合は、自動で reference 更新してから test を実行できます
  - reference が時間経過で変化するプロジェクトで有用です

## Install

```console
$ npm install -D @mizdra/eco-backstopjs-runner backstopjs
$ yarn add -D @mizdra/eco-backstopjs-runner backstopjs
```

## Usage

CLI インターフェイスは本家 Backstop.js と可能な限りの互換性を持たせています。ただし、カスタムランナーの内部で `reference`/`test` コマンドの制御をしているため、本家 Backstop.js にはあったサブコマンド (`test`/`reference`/`approve`/...) がありません。

```console
$ # basic
$ eco-backstop --config backstop.json

$ # JavaScript の設定ファイルを使う
$ eco-backstop --config backstop.config.js

$ # docker 経由で backstop を実行
$ eco-backstop --config backstop.json --docker

$ 特定のシナリオのみ実行
$ eco-backstop --config backstop.json --filter <scenarioLabelRegex>
```

また、設定ファイルにはいくつか必須要件があります。

- `id` が必須です
- `paths.bitmaps_reference` が必須です
- `paths.bitmaps_test` が必須です
- `paths.html_report` が必須です
- `paths.json_report` が必須です
- `report` が必須です
  - `"browser"`, `"json"` が含まれている必要があります

```json
// サンプル
{
  "id": "visual regression test",
  "paths": {
    "bitmaps_reference": "backstop_data/bitmaps_reference",
    "bitmaps_test": "backstop_data/bitmaps_test",
    "html_report": "backstop_data/html_report",
    "json_report": "backstop_data/json_report"
  },
  "report": ["browser", "json"]
  // ...
}
```

---
_Source: https://npm.io/package/@mizdra/eco-backstopjs-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
