Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Error: Could not resolve a module for a custom reporter. Module name: jest-trx-results-processor #408

Open
hoovercj opened this issue Nov 28, 2023 · 2 comments

Comments

@hoovercj
Copy link

hoovercj commented Nov 28, 2023

Describe the bug

First reported here: storybookjs/storybook#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

@jonniebigodes
Copy link
Contributor

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.

@abenhamdine
Copy link

abenhamdine commented Feb 3, 2024

same here
we are unable to use a custom reporter in the ejected jest configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants