WebStorm/Intellij Gherkin tests configuration run - testing

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:

Related

Run CMD/Powershell command before the build command?

How I can run a CMD/Powershell before my Java GUI Application will be build and invoked.
I want run the command: sass ANYFILE.scss:ANYFILE.css to compile my scss file first.
In the Run/Debug Configurations I found nothing which helps me at the Before launch option.
Add the External Tool in IDE which will run any command you want, then add it in Before launch section.
There is a PowerShell plugin that provides a run configuration to run powershell scripts. You can add it as Before launch option as well.

IntelliJ Idea Community Edition - how to run all Dart unit tests in a project

If I right click in a test file I can choose to run it. How do I run all the tests in my dart project within IntelliJ.
In VSCode an action exists that scans the project for files labelled _test.dart, is this VSCode / plugin specific or is it possible to do this in Intellij?
In Dart Test run configuration, you can set Test Mode to All in Folder to run all files that end with _test.dart in specified directory (similar to running pub run test path/to/dir in terminal):

Persisting run configuration when running tests from IntelliJ gutter

I want to run JavaScript tests from the IntelliJ gutter (the green double-arrow icons on the left side, by the line numbers).
I've set up a Run/Debug configuration for Mocha that works fine when it's used to run all my unit tests at once.
Its Node interpreter is the project's, at v8.11.4.
Its Node options are empty.
Its working directory is my/project/src.
Its environment variable is BABEL_ENV=test.
Its Mocha package is my/project/src/node_modules/mocha.
Its UI is mocha-when-then.
Its extra Mocha options are --compilers js:babel-core/register --require babel-polyfill --require ./testSetup.js --require ignore-styles.
Its test directory is my/project/src/test/, set to "All in directory".
Everything works fine when running the main, all-tests configuration. But when I run an individual test or test suite from the gutter, I get errors, because IntelliJ generates a new configuration with default settings, like blank fields for Mocha options and environment variables. I can work around this by manually copying the settings over, but having to do that for every single run is a huge waste of time.
My co-workers don't have this problem even though their configuration is identical to mine. (Identical in the IntelliJ Run/Debug Configurations menu, anyways. Obviously, something is different between our setups.)
How can I make the project settings apply or persist to tests that I run from the gutter?

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.

PhantomJS teamcity config

In a teamcity config I have build step which runs PhantomJS tests. It is a "Command Line" step with custom script. The script looks like:
%PhantomJS% CreateEntityPopupTest\unit.htm
%PhantomJS% ExcelImportPopupTest\unit.htm
...
etc.
So it runs each qunit test package mentioned in the htm page. But I didn't manage to find a way to point PhantomJS (phantomjs-1.9.0-windows) to a folder, not to a single file. So there would be no need to change the config each time when we add new files with tests.
I used Chutzpah to wrap this behavior for use in TeamCity. Chutzpah can run tests written in QUnit, Jasmine or Mocha and uses PhantomJS as the headless test runner.
https://github.com/mmanela/chutzpah
I installed it on the build agents and added it to the path on the machine.
Now I simply add a Command line runner step called 'Run JS Test' in my build template. Command line is simply:
chutzpah.console.exe %jsTestFolder%
Then I just define the parameter for each project pointing to a folder... chutzpah does the rest.