From 897ddba957a51ab937c14c56295845565fc781a7 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Sat, 22 Jun 2024 13:01:03 +0200 Subject: [PATCH] document errorMessageFormatter --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 8dcb96c8..42052c10 100644 --- a/README.md +++ b/README.md @@ -729,6 +729,23 @@ const config: TestRunnerConfig = { export default config; ``` +#### errorMessageFormatter + +The `errorMessageFormatter` property defines a function that will pre-format the error messages before they get reported in the CLI: + +```ts +// .storybook/test-runner.ts +import type { TestRunnerConfig } from '@storybook/test-runner'; + +const config: TestRunnerConfig = { + errorMessageFormatter: (message) => { + // manipulate the error message as you like + return message; + }, +}; +export default config; +``` + ### Utility functions For more specific use cases, the test runner provides utility functions that could be useful to you.