question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example project's tests can't be run with intellij

See original GitHub issue

Describe the bug I cloned the examples folder of the jest builder and tried to run the multiple-apps example directly from intellij and it didn’t work. The first app (my-first-app) runs correctly. The second one (my-second-app) uses a testMatch option which searches test files in my-first-app and when running my-shared-library tests the rootDir is set to the lib root. Running the tests via ng test <project-name> from a terminal works fine, however.

This could be either a configuration issue within the example app or with intellij passing the wrong parameters. Maybe @segrey can have a look at the intellij side.

To Reproduce Steps to reproduce the behavior:

  1. Clone and open the multiple-apps example with intellij
  2. Do an npm or yarn install
  3. Execute a test case in each of the three projects directly from intellij (the little play button)

Expected behavior Each test case should be executable within intellij

Builder:

  • jest-builder
  • v7.2.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
just-jebcommented, Jan 31, 2019

Ok, I got this. I was under the wrong impression that the problem is with IntelliJ specifying the wrong working directory. But in fact, if we look at the error it’s clear that the problem is that Jest cannot find the jest-preset-angular/preprocessor.js file.
This is because it’s looking at <rootDir>/node_modules/jest-preset-angular/preprocessor.js which, in turn, comes from the preset configuration itself.
So it seems that the right way to go is if jest-builder was overriding this path with the ${workspaceRoot}/node_modules/.... This would allow Jest to find the preprocessor disregarding the <rootDir>. Will fix that.

0reactions
just-jebcommented, Feb 1, 2019

Fixed in 7.2.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run tests | IntelliJ IDEA Documentation - JetBrains
To run all tests in a folder, select this folder in the Project tool window and press Ctrl+Shift+F10 or select Run Tests in...
Read more >
Example project's tests can't be run with intellij #203 - GitHub
Running the tests via ng test <project-name> from a terminal works fine, however. This could be either a configuration issue within the example...
Read more >
Running tests on Intellij: Class not found - Stack Overflow
Worked for me. My project has sub maven modules and instead of creating 1 rootmodule.iml it created an iml file for each sub...
Read more >
IntelliJ Plugin - Kotest
The Intellij plugin requires Kotest 4.2 or higher and will not run common tests of a multiplatform ... For example, you can quickly...
Read more >
Unit Testing and Coverage in IntelliJ IDEA - YouTube
Find out how to: - Create test classes and test methods - Run and re- run tests - Debug code - Measure test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found