storycap-testrun v2 introduces significant improvements with a focus on simplicity, better maintenance, and clearer package structure. This version drops legacy features and reorganizes the package architecture to better serve the two primary Storybook testing workflows.
Key improvements in v2:
- Simplified package structure with clear separation for different testing environments
- Streamlined hook API for better developer experience
- Improved maintainability by removing complex, rarely-used features
- Better alignment with modern Storybook testing practices
- Package restructuring: The legacy
storycap-testrunpackage is deprecated in favor of framework-specific packages - Storybook v7 support dropped: Only Storybook v8+ is supported
- Hook API changes:
postCapturesignature simplified fromScreenshotImagetofilepath - Feature removal:
output.dryoption removed due to limited usage and implementation complexity
The monolithic storycap-testrun package has been split into two focused packages. Choose the appropriate package based on your testing setup:
Before (v1):
npm install --save-dev storycap-testrunAfter (v2):
npm uninstall storycap-testrun
npm install --save-dev @storycap-testrun/nodeUpdate your test-runner setup:
// Before (v1)
import { screenshot } from 'storycap-testrun';
// After (v2)
import { screenshot } from '@storycap-testrun/node';Storybook v7 support has been dropped. Ensure you're using Storybook v8 or later.
The postCapture hook no longer receives the ScreenshotImage object as the third argument. Instead, it receives the filepath string.
const myHook = {
postCapture: async (page, context, image) => {
// Access image data
const buffer = image.buffer;
const filepath = image.path;
// Custom processing...
},
};const myHook = {
postCapture: async (page, context, filepath) => {
// Only filepath is provided
// Access image data by reading the file if needed
const fs = require('fs');
const buffer = fs.readFileSync(filepath);
// Custom processing...
},
};The output.dry option has been removed. If you were using this feature, you'll need to implement similar functionality manually:
Before (v1):
const config = {
output: {
dry: true, // This option is no longer available
},
};