how the ide auto-detects the test framework in the project?

I'm using Intellij 2018.2. I can't understand the logic behind the automatic detection of the test framework of the project.

I created a node/npm project and included mocha for testing. all the tests are in a "test" folder

when I right-click on the test folder Intellij show me this:

where the testing framework detected is the python testing framework.(why?)

 

If i right click in a test file i get this:

in this case the framework selected is mocha.

But if i install the karma test runner plugin then intellij detect python Unittest for the folder and karma for the files.

So there is a way to tell the ide that has to auto-detect only a certain frameworks?

I know i can create a run configuration but the right click is much faster especially when i have to test only some assertions.

 

0
2 comments

The logic used for determining what test runner is available for a given test file is based on dependencies declarations in package.json nearest to the current file.
If you  have mocha listed among project dependencies, the corresponding options are available in right-cick menu. If you have a single package.json, with both karma and mocha included, and there is a karma config in your project, karma is preferred - see https://youtrack.jetbrains.com/issue/WEB-26070#comment=27-2088951.

 

Running javascript tests from a folder right-click menu is not supported; please vote for https://youtrack.jetbrains.com/issue/WEB-29848

2
Avatar
Permanently deleted user

thanks for the great support!

1

Please sign in to leave a comment.