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]: Github actions repoter throwing error #12830

Closed
param-finder opened this issue May 10, 2022 · 6 comments
Closed

[Bug]: Github actions repoter throwing error #12830

param-finder opened this issue May 10, 2022 · 6 comments

Comments

@param-finder
Copy link

Version

^26.6.3

Steps to reproduce

Add reporters: ['default', 'github-actions'], in the jest.config file and run the tests.

Expected behavior

It should pass the test command

Actual behavior

$ jest
Error: Could not resolve a module for a custom reporter.
Module name: github-actions
at /Users/parmindersingh/Documents/FinderUK/node_modules/jest-config/build/normalize.js:558:15
at Array.map ()
at normalizeReporters (/Users/parmindersingh/Documents/FinderUK/node_modules/jest-config/build/normalize.js:540:33)
at normalize (/Users/parmindersingh/Documents/FinderUK/node_modules/jest-config/build/normalize.js:633:5)
at readConfig (/Users/parmindersingh/Documents/FinderUK/node_modules/jest-config/build/index.js:224:68)
at async readConfigs (/Users/parmindersingh/Documents/FinderUK/node_modules/jest-config/build/index.js:406:26)
at async runCLI (/Users/parmindersingh/Documents/FinderUK/node_modules/@jest/core/build/cli/index.js:230:59)
at async Object.run (/Users/parmindersingh/Documents/FinderUK/node_modules/jest-cli/build/cli/index.js:163:37)
error Command failed with exit code 1.

Additional context

I'm following the jest docs and its mentioned there as, I assume there's no need to install explicitly a custom reporter for this. If so, what's the official package name?

GitHub Actions Reporter
If included in the list, the built-in GitHub Actions Reporter will annotate changed files with test failure messages:

{
"reporters": ["default", "github-actions"]
}

Environment

System:
    OS: macOS 12.3.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 14.18.1 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
  npmPackages:
    jest: ^26.6.3 => 26.6.3
@mrazauskas
Copy link
Contributor

GitHub Actions Reporter only works with Jest 28.

By the way, config documentation for Jest 26 can be found here: https://jestjs.io/docs/26.x/configuration

@param-finder
Copy link
Author

@mrazauskas I updated to v28 and now I'm getting facebook/react-native#33751 (comment)

● Invalid return value:
      `process()` or/and `processAsync()` method of code transformer found at
      "/Users/.../assetFileTransformer.js"
      should return an object or a Promise resolving to an object. The object
      must have `code` property with a string of processed code.
      This error may be caused by a breaking change in Jest 28:
      https://jestjs.io/docs/upgrading-to-jest28#transformer
      Code Transformation Documentation:
      https://jestjs.io/docs/code-transformation

@mrazauskas
Copy link
Contributor

Your transformer which is mentioned in the error message is causing this. Just follow upgrade guide. The link to the guide is also included in the error message (;

@param-finder
Copy link
Author

param-finder commented May 10, 2022

https://jestjs.io/docs/upgrading-to-jest28#transformer
shows
Screenshot 2022-05-10 at 14 45 22
I get the error but would be better if there are any resolution steps for solving this error with respect to react-native. The assetFileTransformer.js happens to be inside react-native/jest which is beyond our control. As I've checked react-native package.json is still using version 26.6.3

@mrazauskas
Copy link
Contributor

See facebook/react-native#33756

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants