Registry / testing / test-runner-with-snap-speed-exp

test-runner-with-snap-speed-exp

JSON →
library0.0.1jsnpmunverified

The `test-runner-with-snap-speed-exp` package is an experimental, early-stage test runner specifically designed for Storybook stories. Currently at version `0.0.1`, it aims to provide a fast and integrated testing experience for UI components, likely leveraging Playwright for browser automation and potentially integrating with Jest and Testing Library for assertions and component interactions. Its core utility is to allow developers to write tests that directly target Storybook stories, facilitating visual and functional regression testing within the Storybook ecosystem. Given its `0.0.1` version, it is under active development, but a stable release cadence is not yet established, and API changes are highly probable. Key differentiators include its tight coupling with Storybook for isolated component testing and a focus on testing speed.

npm install test-runner-with-snap-speed-exp
INSTALL
IMPORT
SIG · TEST-RUNNER-WITH-S
T
test-runner-with-snap-speed-exp
testingjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

runStoriesTests
import { runStoriesTests } from 'test-runner-with-snap-speed-exp';
const runStoriesTests = require('test-runner-with-snap-speed-exp');
The library is likely ESM-first given modern JavaScript trends and its experimental nature. CommonJS `require` might not work or require specific configuration.
Config
import type { Config } from 'test-runner-with-snap-speed-exp';
Type imports are crucial for TypeScript users to get correct type inference for configuration objects or test definitions.
toHaveNoViolations
import { toHaveNoViolations } from 'test-runner-with-snap-speed-exp/matchers';
Assuming a common pattern where matchers for assertions are exported from a subpath, similar to Jest or Playwright expectations.

This quickstart demonstrates how to configure and run tests against a Storybook instance using the `test-runner-with-snap-speed-exp`. It sets up a basic Playwright environment, navigates to individual stories, and performs a visual snapshot test for each. It's designed to be run as part of a CI/CD pipeline or local development process.

import { runStoriesTests } from 'test-runner-with-snap-speed-exp'; import { expect } from '@playwright/test'; // Assuming a Storybook instance is running at http://localhost:6006 const storybookUrl = process.env.STORYBOOK_URL ?? 'http://localhost:6006'; const config = { storybookUrl: storybookUrl, /** * Function to execute before all stories are loaded. * Useful for global setup like custom Playwright setup or mocking. */ setup: async ({ page }) => { await page.goto(storybookUrl); console.log(`Navigated to Storybook at ${storybookUrl}`); }, testMatch: ['**/*.stories.ts?(x)', '**/*.stories.js?(x)'], /** * Define custom test logic for each story. * This example performs a basic snapshot comparison. */ test: async ({ page, story, test }) => { test(`Story: ${story.title} - ${story.name}`, async () => { await page.goto(story.url); // Wait for the story to fully render and stabilize await page.waitForSelector('#root div'); // Simple visual snapshot test using Playwright's API // In a real scenario, a more robust snapshot library would be integrated. const screenshotPath = `screenshots/${story.title.replace(/ /g, '_')}-${story.name.replace(/ /g, '_')}.png`; await expect(page).toHaveScreenshot(screenshotPath, { maxDiffPixelRatio: 0.05 }); console.log(`Snapshot taken for ${story.title}/${story.name}`); }); }, }; // Execute the test runner runStoriesTests(config).catch(error => { console.error('Test runner failed:', error); process.exit(1); });
test-runner-with-snap-speed-exp --version
Debug
Known issues
breakingAs a `0.0.1` package, the API is highly unstable and subject to frequent breaking changes without prior notice. Expect `import` paths, function signatures, and configuration options to change between minor or even patch versions.
fix
Always refer to the latest (or your installed) package documentation. Pin specific patch versions (`0.0.1`) and review `CHANGELOG.md` or `package.json` for updates.
affects: >=0.0.1
gotchaThis package relies heavily on external tools like Storybook and Playwright. Version incompatibilities between these dependencies can lead to unexpected failures, especially with Playwright's rapid release cycle.
fix
Ensure that your `storybook`, `playwright`, and `test-runner-with-snap-speed-exp` versions are compatible. Check their respective documentation or GitHub issues for known compatibility matrices. Use `npm list <package>` to check installed versions.
affects: >=0.0.1
gotchaPerformance (`snap-speed`) claims are likely experimental. Large Storybook setups or complex components might experience slow test execution or high resource consumption, negating the 'speed' aspect.
fix
Start with a small subset of stories. Profile test runs using Playwright's tracing tools. Consider optimizing Storybook build performance or splitting large test suites.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'test-runner-with-snap-speed-exp' from '<your-project-path>'
The package might not be installed, or there's a problem with module resolution (e.g., trying to `require` an ESM-only package in a CommonJS context).
fix
Ensure the package is installed: `npm install test-runner-with-snap-speed-exp`. If using `import`, ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).
Error: Playwright browser did not launch correctly. Make sure you have installed browser binaries.
Playwright binaries are not installed or are corrupted, or a `playwright install` command was missed after installation.
fix
Run `npx playwright install` to download the necessary browser binaries. Ensure your environment has sufficient disk space and network access for the download.
Error: Storybook URL 'http://localhost:6006' is not reachable or returned a non-200 status.
The Storybook instance is not running or is accessible on a different port/URL than configured in the test runner.
fix
Verify your Storybook server is running (`npm run storybook` or equivalent). Check the port and host. Update the `storybookUrl` in your `test-runner-with-snap-speed-exp` configuration to match the actual Storybook URL.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
@storybook/test-runnerrequiredLikely a peer dependency or a base it builds upon for Storybook integration.
storybookrequiredPeer dependency as it tests Storybook stories.
playwrightrequiredCore dependency for browser automation and rendering Storybook stories.
jestoptionalCommonly used for assertions and test orchestration in conjunction with test runners.
@testing-library/reactoptionalOften used for component interaction and assertions within tests.
Agent activity
7 hits · last 30 days
node
4
Resources
test-runner-with-snap-speed-exp — npm install test-runner-with-snap-speed-exp · libregistry