npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mizdra/eco-backstopjs-runner

v0.0.6

Published

Eco-friendly Backstop.js runner.

Downloads

11

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

$ 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/...) がありません。

$ # 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" が含まれている必要があります
// サンプル
{
  "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"]
  // ...
}