Nx: Run jest within intellij

Created on 25 Jul 2019  路  8Comments  路  Source: nrwl/nx

Prerequisites

Please answer the following questions for yourself before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [ ] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

I am not sure if this is an Nx related issue. I am using another builder (https://www.npmjs.com/package/@angular-builders/jest) in a diferent project where everything works fine, though.

Expected Behavior

When creating a fresh Nx workspace with angular and jest I expect to be able to run any jest test from within intellij IDEA (I use the ultimate edition 2019.2).

Current Behavior

An exception occurs:

An unhandled exception occurred: reporters.find is not a function
See "/private/var/folders/dn/6yw0_6l52pb_zsjqss035h1h0000gn/T/ng-TfsdqI/angular-errors.log" for further details.

Logfile content:

[error] TypeError: reporters.find is not a function
    at TestScheduler._shouldAddDefaultReporters (/Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/TestScheduler.js:411:19)
    at TestScheduler._setupReporters (/Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/TestScheduler.js:423:28)
    at new TestScheduler (/Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/TestScheduler.js:194:10)
    at /Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/runJest.js:412:29
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/runJest.js:148:24)
    at _next (/Users/sroettering/git/jest-intellij-demo/node_modules/@jest/core/build/runJest.js:168:9)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. clone https://github.com/sroettering/jest-intellij-demo which contains a fresh nx workspace with angular and jest
  2. open the project with intellij IDEA
  3. Edit the jest run configuration template to use @angular/cli as jest package
    image
  4. open any .spec.ts file and try to run a test by clicking on the play button to the left (or press ctrl + shift + r)

Context

Please provide any relevant information about your setup:

image

feature

Most helpful comment

Well then I hope @dopsonbr resolves the conflicts soon.

All 8 comments

There is a PR already for that #1467

Well then I hope @dopsonbr resolves the conflicts soon.

I'm having the same problem, can I help in some way?

I already opened PR #1657 which basically resolves the conflicts from #1467 and fixes the tests.

Yep, this above PR fixes issues - i tested it BUT its not now possible to run just "ONE" test, I have raised an issue here on github.

Trying to run just "one" test, actually runs them all.

In your issue you say you used nx 8.4.4 which was released 5 days ago but my PR was only merged 15 hours ago. Are you sure that my PR would not fix your issue as well?

8.4.4 was released 11 hours ago, and it includes your fix as far as i can see..

image

Actually - it is working a lot better, you can run tests now - and before you could not - but as I say, you can't run individual tests.

ok my fault. then #1693 needs to be solved as well. I will close this issue as it is now possible to run the tests in intellij

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieldanielecki picture danieldanielecki  路  3Comments

IonFoXx picture IonFoXx  路  3Comments

Svancara picture Svancara  路  3Comments

dereklin picture dereklin  路  3Comments

ZempTime picture ZempTime  路  3Comments