Debugging mocha tests run by gulp in Intellij Idea - intellij-idea

I have the following configuration in my gulpfile.js:
gulp.task('spec', function() {
gulp.src('spec/runner.html')
.pipe(mocha({reporter: 'dot'}))
})
When I run nodejs inside IntelliJ Idea, the scripts files imported by spec/runner.html are not loaded by the IDE and therefore the breakpoints are ignored. Is there a solution to this?

In your run configuration options, for "JavaScript file" put the value:
node_modules/gulp/bin/gulp.js
Then put your gulp parameters in the "Application parameters".
WebStorm 9 EAP has native gulp integration, but this works until that is final.

Related

Wrong Jest package in Intellij IDEA run configuration detected

I want to run the tests of my frontend project, but everytime I want to start a test I get the following error:
In the Run Configurations, IntelliJ selected #angular/cli as default Jest package, which is wrong.
The correct Jest package should be jest.
After I select the correct package, Jest works and runs the selected test.
I have to do this, everytime I want to run a test.
This is not a local problem, my coworkers have the same problem in this project.
Try editing Jest run configuration template: choose the desired Jest package there, save the configuration. New configurations created from gutter/right-click menus will use these settings, you won't need to care of specifying them for each configuration

WebStorm/Intellij Gherkin tests configuration run

How to set up running configuration with WebStorm feature file?
When I click on green run button seems that WebStorm can't find the steps realisation.
How could I change that WebStorm understands from where should it take steps?
When I run tests with command line it works, I have config file where I declared steps folder.
You can specify --require path/to/step/definitions as Cucumber.js arguments: field:

gradlew clean deployNodes - QUASAR WARNING: Quasar Java Agent isn't running

When I run "gradlew clean deployNodes" or "gradlew deployNodes", I get a warning on Quasar library:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using another instrumentation method you can ignore this message; otherwise, please refer to the Getting
Started section in the Quasar documentation.
How can i fix this warning ?
I upgraded Corda to 4.1
you'll want to double-check the intellij settings.
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
As mentioned in the comments from manish, make sure to try cleaning the gradle cache as well: ./gradlew clean build deployNodes.
Joel has a good answer for a similar quasar issue on this StackOverflow question: Error when running Corda flow tests from IntelliJ

IntelliJ file watcher uses wrong grunt

I'm setting up grunt with the IntelliJ file watcher plugin.
As you can see in the image I choose as path for my installed grunt the following:
C:\Users\Max\AppData\Roaming\npm\grunt.cmd
Nevertheless if I save my project IntelliJ doesn't find my grunt...
If I execute grunt in the terminal with "grunt" all works.

How do I make IntelliJ create Mocha debug configs when running unit tests?

When I create a new Mocha test file I am presented with the expected green gutter icons (▶ and ▶▶) to run each test or the suite. When I select "Run [test name]" I expect it to create a Mocha debug configuration and run it. Instead, IntelliJ creates a NodeJS run configuration, which understandably explodes in a shower of bit-flavored WTF.
If I manually create a configuration for the whole file, everything works as expected, including individual tests afterward. I am hoping that there is a setting somewhere that I have overlooked, something like "Settings -> ... -> Default Debug Configuration".
Does anyone know how I can make IntelliJ default to Mocha when a unit test is executed?
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 current file. Do you have 'mocha' listed as a dependency/dev dependency in your package.json? How many package.json files do you have in your project?
Note that, if Mocha is not installed locally/included in package.json, you can create a Mocha run configuration with "All in directory" selected and specify a directory where your spec files are located. In this case, clicking the gutter button in a test file inside this directory will suggest to run test with Mocha.
Note also that if you have created Node.js Run configuration with "JavaScript file" set to your mocha test file, IDEA will suggest using this configuration instead of Mocha when clicking on your tests, because explicitly created run configurations associated with current file have priority over the ones auto-generated from context. Deleting the configuration should solve the issue.