The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Build Storybook in CI, run Loki against that build with --requireReference, and fail the job when a story has an unexpected visual difference or lacks an approved baseline. The essential workflow is: create and review references locally, commit them, then let CI compare new renders without updating those references automatically.
What CI needs to run Loki
Loki tests Storybook stories, so the pipeline needs a working Storybook build or server, a renderer your CI runner can support, and committed reference images for the stories under test. The setup commands below follow Loki’s official documentation; its relevant setup pages were last updated on 2024-08-27, so check them against the Loki and Storybook versions pinned in your project.
As an Amazon Associate I earn from qualifying purchases.
- A supported Node.js environment. Loki’s getting-started documentation specifies Node 16 or later, a version-sensitive requirement to verify for your installed release.
- A usable Storybook build and a known output directory.
- A renderer and any required dependencies. Depending on your choice, the documentation mentions Docker, local Chrome, an iOS simulator, or an Android emulator; the selected runner must be able to provide it.
- Approved reference images committed to the repository, so CI can detect missing baselines and compare current renders.
GraphicsMagick and Docker are optional prerequisites depending on the diff engine or renderer you select. Do not install them by default without checking the configuration your project actually uses.
Install Loki and initialize its configuration
-
Add Loki as a development dependency:
yarn add loki --dev.#1 Best Overall
SaleMicrosoft Windows Server 2022 Standard | Base License with media and key | 16 Core- Server 2022 Standard 16 Core
-
Initialize its configuration:
yarn loki init. -
Review the generated
lokiconfiguration inpackage.json. Initialization detects a project type and writes defaults, but the detected renderer and other settings still need to fit your Storybook, CI runner, and desired coverage.
These are the commands in Loki’s getting-started guide. Check Node and command requirements against the Loki version you pin rather than treating the documentation snapshot as a current compatibility guarantee.
Create and commit reference screenshots
-
Run
yarn loki updatein the intended baseline environment to generate references.PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Inspect the resulting screenshots and differences. Approve only changes that reflect intended UI updates; a generated image is not automatically a correct baseline.
-
Commit approved references to Git. Loki’s setup guide describes references in a
lokifolder and says image files should be checked into Git; Git LFS is an optional storage choice.Rank #2
HP ProLiant DL360 G7 1U RackMount 64-bit Server - Dual 6-Core X5675 Xeon 3.06GHz CPUs - 72GB PC3-10600R RAM - 4x900GB 10K SAS SFF HDD - P410i RAID, 4xGigaBit NIC - 2 PSU (Renewed)- HP ProLiant DL360 G7 Business Server, the perfect enterprise server or small business server!
- Processors: Dual (2) Xeon X5675 6-Core 3.06 GHz 12MB CPUs Max Turbo 3.46 GHz
- Memory: 72GB (4 x 16GB) DDR3 PC3-10600R Memory; Storage: 3.6TB (4 x 900GB) 10K 12Gb/s SAS 2.5" HDDs
- Power: Redundant Power Supplies; RAID: HP Smart Array P410i-a 12Gb/s with 4×GigaBit NIC
- Hard drives and memory upgrades included separately NOT installed, installation required.
The CLI documentation lists default paths as ./.loki/reference for references, ./.loki/current for current renders, and ./.loki/difference for diffs. Confirm paths for your installed version and configuration before relying on them in scripts or CI artifact collection.
Build Storybook and run Loki in CI
Loki’s documented static-build CI pattern is:
build-storybook && loki --requireReference --reactUri file:./storybook-static
The build command must succeed before Loki runs. The file: URI points Loki at the static Storybook directory, and --requireReference makes a missing baseline fail instead of silently treating it as an accepted new reference. In this workflow, the CI guide says a Storybook server is generally unnecessary and CI should not update reference images.
Recommended Free Tools
You can expose the sequence as a package script. This is an example; adapt the script name and build output path to the project:
{
"scripts": {
"test:visual": "build-storybook && loki --requireReference --reactUri file:./storybook-static"
}
}
Run yarn test:visual or your equivalent CI command. If passing Loki options directly through Yarn or npm, the CLI guide notes that a -- separator may be needed so the package manager forwards arguments to Loki. Confirm the exact syntax with your package manager and pinned CLI version.
Keep baseline updates out of the normal test job
Use a separate, deliberate review workflow for baseline changes. When a visual test fails, inspect the current render and difference, decide whether the change is intended, and update and commit references only after approval. Loki’s CLI approve command can accept generated references; --diffOnly limits approval to failed tests. Avoid putting an unconditional update or approval step in the ordinary CI test job, because it would erase the distinction between a detected regression and an accepted change.
Rank #3
Choose a renderer your CI can reproduce
Loki documents several targets: Chrome in Docker, local Chrome, the iOS simulator, and the Android emulator. Its configuration reference includes targets such as chrome.docker, chrome.app, ios.simulator, and android.emulator. Pick based on the platform coverage you need and what your runners can install and keep consistent.
| Target | Use it when | CI consideration |
|---|---|---|
chrome.docker |
You want the Docker-based Chrome target documented by Loki. | The runner must support the required Docker setup. The docs do not establish a universal runner configuration. |
chrome.app |
You want Loki’s local Chrome target. | Provide a compatible Chrome installation in the runner and keep the environment stable. |
ios.simulator |
You need iOS simulator coverage. | The runner must support the simulator; the docs do not establish availability across CI providers. |
android.emulator |
You need Android emulator coverage. | The runner must support the emulator; the docs do not establish availability across CI providers. |
The configuration guide also covers viewport dimensions, presets, device settings, selectors, and diff-engine choices. Use the options relevant to the product’s intended coverage, and keep them fixed across baseline generation and CI comparison. Loki’s documentation does not provide a current benchmark or a universal best renderer.
Make CI output easier to diagnose
The CLI reference documents --verboseRenderer for renderer logging, plus --configurationFilter and --targetFilter to narrow a run. These flags are version-sensitive; verify them against the CLI you have pinned before adding them to scripts.
Reduce flaky visual results
Control the page state before comparing images. Loki says it disables common CSS transitions and requestAnimationFrame behavior by default, but its flakiness guide identifies cases that can remain nondeterministic:
- Looping
requestAnimationFramebehavior - GIFs and animated SVGs
- React Native Animated
- Stories that render asynchronously without a clear completion signal
For asynchronous stories, Loki documents an explicit completion pattern using @loki/create-async-callback. For stories that should not be captured, the documented story setting is loki: { skip: true }. Use skipping selectively: excluding a story also means CI will no longer catch visual regressions in it.
Rank #4
For failures, examine the rendered image and diff rather than treating every pixel change as a product defect or accepting it automatically. Differences can reflect an intentional UI change, a changed rendering environment, or unstable story content; investigate which applies before changing references.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common CI failures
Loki cannot find a reference
Likely cause: No baseline was committed, the reference path differs from the configured path, or the test is running against a different story set. Fix: Generate references with yarn loki update, review them, commit approved files, and confirm the configured reference directory. Keep --requireReference enabled in CI so this condition stays visible.
The static Storybook directory is missing
Likely cause: The build did not run, the build command differs in the project, or its output path is not storybook-static. Fix: Confirm the build script and output directory, then point --reactUri at the actual directory. The documented command is an example, not a universal Storybook script.
The renderer fails to start
Likely cause: The selected target’s runtime dependency is unavailable on the CI runner. Fix: Match the Loki target to runner capabilities and install or provide its required environment. Use --verboseRenderer if supported by the pinned CLI to collect more renderer detail.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Images differ repeatedly without code changes
Likely cause: Nondeterministic animation, asynchronous content, or a mismatch between baseline and CI rendering configuration. Fix: Stabilize the story, use Loki’s async completion pattern where applicable, exclude genuinely nonessential stories, and keep renderer, viewport, device settings, and diff configuration consistent.
Best Value
Arguments passed through a package manager have no effect
Likely cause: The package manager is consuming flags instead of forwarding them to Loki. Fix: Check the CLI guidance for your package manager; an extra -- separator may be required.
Scale only when the ordinary runner is not enough
Loki documents AWS Lambda as an optional remote rendering path for very large suites. Its guide requires creating a renderer Lambda and making the Storybook build remotely accessible, with S3 and HTTPS described as an approach. This adds AWS deployment and access configuration; it is not a prerequisite for a standard CI setup. The Lambda guide was last updated on 2024-08-27, so verify runtime and packaging instructions against current AWS support before adopting it. The documentation does not establish a speed threshold at which Lambda is worthwhile.
Or skip the browser setup
If you need a screenshot of a web page rather than Storybook-based visual regression tests, ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. It does not replace Loki’s story baselines and comparison workflow.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteWith an API key, this cURL request saves a screenshot as WebP:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for options and setup. ScreenshotNeo removes cookie banners, popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the Free plan includes 1,000 screenshots per month with no card required. Paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up free.
Frequently Asked Questions
Can Loki test stories without a static Storybook build?
Yes, Loki also supports other Storybook input and renderer configurations; the static-file command here is the documented CI pattern, not the only possible setup.
Does Loki automatically approve visual changes in CI?
No. The recommended workflow is to inspect differences and update approved reference images deliberately rather than having the normal test job accept them.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

