test-runner
test-runner copied to clipboard
[bug] Error: Could not resolve a module for a custom reporter. Module name: jest-trx-results-processor
Describe the bug
First reported here: https://github.com/storybookjs/storybook/discussions/25003
I am unable to run storybook tests with a custom test runner.
Note: We use this reporter in our normal jest tests within the same project without problem
Following these instructions
you can add additional reporters by ejecting the configuration as explained above and overriding (or merging with) the reporters property.
I have ejected and modified the config as follows:
const { getJestConfig } = require('@storybook/test-runner');
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
// The default configuration comes from @storybook/test-runner
...getJestConfig(),
/** Add your own overrides below
* @see https://jestjs.io/docs/configuration
*/
reporters: [
"default",
"jest-trx-results-processor"
],
};
But when running the tests, I get this error:
Error: Could not resolve a module for a custom reporter.
Module name: jest-trx-results-processor
at <Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\normalize.js:523:15
at Array.map (<anonymous>)
at normalizeReporters (<Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\normalize.js:505:20)
at <Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\normalize.js:883:17
at Array.reduce (<anonymous>)
at normalize (<Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\normalize.js:732:14)
at readConfig (<Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\index.js:219:74)
at async readConfigs (<Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-config\build\index.js:404:26)
at async runCLI (<Project Directory>\node_modules\@storybook\test-runner\node_modules\@jest\core\build\cli\index.js:140:59)
at async Object.run (<Project Directory>\node_modules\@storybook\test-runner\node_modules\jest-cli\build\cli\index.js:155:37)
System
Please paste the results of npx storybook@latest info
here.
System: OS: Windows 11 10.0.22621 CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz Binaries: Node: 16.14.0 - C:\Program Files\nodejs\node.EXE npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD <----- active Browsers: Edge: Chromium (119.0.2151.72) npmPackages: @storybook/addon-a11y: 6.5.16 => 6.5.16 @storybook/addon-actions: 6.5.16 => 6.5.16 @storybook/addon-essentials: 6.5.16 => 6.5.16 @storybook/addon-interactions: 6.5.16 => 6.5.16 @storybook/addon-links: 6.5.16 => 6.5.16 @storybook/addon-postcss: 2.0.0 => 2.0.0 @storybook/addon-storyshots: 6.5.16 => 6.5.16 @storybook/addon-storysource: 6.5.16 => 6.5.16 @storybook/builder-webpack5: 6.5.16 => 6.5.16 @storybook/jest: 0.2.2 => 0.2.2 @storybook/manager-webpack5: 6.5.16 => 6.5.16 @storybook/react: 6.5.16 => 6.5.16 @storybook/test-runner: 0.15.2 => 0.15.2 @storybook/testing-library: 0.2.2 => 0.2.2 storybook-addon-designs: 6.2.1 => 6.2.1 storybook-dark-mode: 1.0.8 => 1.0.8
To give some additional context, I tested this with a fresh install of the latest stable Storybook version and it's happening as well. @yannbf when you have a moment, can you provide some context on this and how best to address it? Thanks in advance.
same here
we are unable to use a custom reporter in the ejected jest configuration