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

jest-junit cannot be resolved when univeral-test-runner is installed globally #218

Open
msrose opened this issue Mar 9, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@msrose
Copy link
Contributor

msrose commented Mar 9, 2023

Describe the bug

Even though jest-junit is installed as a dependency of the jest adapter, it can't be resolved when used to generate default jest reports when universal-test-runner is installed globally.

Steps to reproduce

$ npm i -g @aws/universal-test-runner
$ mkdir test
$ cd test
$ npm init -y
$ npm i --save-dev jest
$ run-tests jest # works fine
$ TEP_REPORT_FORMAT="default" run-tests jest # fails
[WARN] [universal-test-runner]: Protocol version not specified! Defaulting to 0.1.0
[INFO] [universal-test-runner]: Found TEP_REPORT_FORMAT in environment, reading value
[INFO] [universal-test-runner]: Using Test Execution Protocol version 0.1.0
[INFO] [universal-test-runner]: Loaded adapter from @aws/universal-test-adapter-jest
[INFO] [universal-test-runner]: Calling executeTests on adapter...
[INFO] [universal-test-adapter-jest]: Running tests with jest using command: node_modules/.bin/jest --reporters jest-junit --reporters default
Error: Could not resolve a module for a custom reporter.
  Module name: jest-junit
    at /Users/msrose/jest/node_modules/jest-config/build/normalize.js:426:15
    at Array.map (<anonymous>)
    at normalizeReporters (/Users/msrose/jest/node_modules/jest-config/build/normalize.js:409:20)
    at /Users/msrose/jest/node_modules/jest-config/build/normalize.js:747:17
    at Array.reduce (<anonymous>)
    at normalize (/Users/msrose/jest/node_modules/jest-config/build/normalize.js:608:14)
    at readConfig (/Users/msrose/jest/node_modules/jest-config/build/index.js:160:74)
    at async readConfigs (/Users/msrose/jest/node_modules/jest-config/build/index.js:421:26)
    at async runCLI (/Users/msrose/jest/node_modules/@jest/core/build/cli/index.js:152:59)
    at async Object.run (/Users/msrose/jest/node_modules/jest-cli/build/run.js:124:37)
[INFO] [universal-test-runner]: Finished executing tests.
[ERROR] [universal-test-runner]: Test run failed with exit code 1

Expected behavior

The jest adapter should use a locally-installed jest-junit if it exists, but succeed if it doesn't and use the globally installed one instead.

Version information

  • OS: macOS Monterey 12.6.2
  • Node.js version: 18.14.2
  • CLI version (npm ls @aws/universal-test-runner): 0.2.0

Additional context

N/A

@msrose msrose added the bug Something isn't working label Mar 9, 2023
@msrose msrose added this to the 1.0.0 release milestone Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant