Node.js: re-run cucumberjs tests automatically on each source file change - cucumberjs

What is the simplest way to tell cucumberjs to watch for source project files changes so that it can re-runs its tests?

You could add a gulp task. Here is more information on how gulp works https://gulpjs.com/docs/en/api/concepts

Related

No spec files found when running Cypress using scripts in package.json

I am trying to use script aliases in the package.json file.
In order for something like this to open the test runner,
"cy:open:prod": "cypress open --env ENV=production",
I run the command npm run cy:open:prod in the command line in the same folder that package.json is located.
The script runs and opens the test runner, however no spec files are found.
In all the examples I have found it describes this approach. Is there something I am missing in configuation to point it to where my spec files are?
Thanks in advance.
There is nothing basically wrong with the scripts in package.json, they look normal and would not cause the problem you mention.
I suggest you check the specPattern setting in configuration, it should match the naming convention you have chosen to use for your specs.
See e2e settings for more details.
Of you still have trouble with it, start a new project and let Cypress set the configuration for you, it will automatically match up the specPattern to the default value.

How to delete reports folder before every run in cypress?

I am storing my cucumber html report under cucumber-html-reports folder and json files are storing under cucumber-json folder. Now I want delete/empty these two folders. I need a plug in to achieve this.
The correct way to do this is to add an npm script to clean up the report folder and execute it before the test run. Cypress has an example npm script on their website for this. https://docs.cypress.io/guides/tooling/reporters#Command-line-3
Usually, the CI/CD pipeline would run the clean up script before the test run kicks off. Alternatively, you could add a little bit of code to your plugins file to exec the npm script before the test run as well.
One sort of hacky option, there is a trashAssetsBeforeRuns option in the Cypress config (set to true by default). It's used to clean up the downloads, videos, and screenshots folders before a test run. If you map your reporter results to one of these directories that might work, although I can't guarantee success with it since I haven't done that.

Gradle Cucumber test generates build folder on daemon instead of project directory

I have a test automation project where basically I run cucumber test via gradle task. What's weird is that the build folder is generated on .daemon folder instead of the project directory. E.g.
/Users/my_user/.gradle/daemon/5.6
Whereas it should be on:
/Users/my_user/my_project/build
Weirdly enough this seems to only happen on my local. Is there anything I might have missed on setting up the gradle?

intellij mocha plugin doesn't always use mocha

Normally from the IntelliJ's 'projects' pane, I can right click on a test file and choose 'debug' or 'run' and the Mocha Plugin intercepts it and automatically creates run/debug configurations for the file. This causes IntelliJ to use the following command: (note presence of mocha)
/usr/local/bin/node --debug-brk=57425 /projects/my_project/node_modules/mocha/bin/_mocha --timeout 3600000 --ui bdd --reporter "/Users/shared/Library/Application Support/IntelliJIdea2016.1/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js" /projects/my_project/tests/src/scripts/my-other-test.js
Other times (for nearly identical files in the same folder) it doesn't: (note mocha is absent)
/usr/local/bin/node --debug-brk=57068 my-test.js
The only way I've been able to run the test file is to manually create a Run Configuration specific to that file.
What do I have to do to encourage the Mocha Plugin to automatically create a run/debug configuration?
You need to make sure that mocha package is installed locally in your project. Mocha plugin checks that and creates mocha-command instead of node-command.

Run Gulp and Redploy in IntelliJ

I'm trying to figure out how after a quick edit of say a .less file or an .html file or a .js file that I can quickly see the changes in the web application running Tomcat being served from IntelliJ.
We've wired Eirslett's frontend-maven-plugin into our project to run Gulp to generate the CSS from the LESS files and other tasks like JS minifying.
The only thing that I know works is to go to the command line and execute mvn clean install from the command line and then re-run the IntelliJ Tomcat configuration.
The problem is this takes many minutes with our build. Seems like there must be some trick where I can tell IntelliJ to just re-run Gulp and then redeploy the CSS, JS and HTML changes without re-compiling all the Java and restarting all my services and other gunk.
I know that if I'm just making changes to HTML or JS or CSS in a simple java web application that doesn't use Gulp that I can issue the 'Build, Compile' (CommandShiftF9) command on the affected files in IntelliJ and IntelliJ will re-deploy those selected files. I'm looking for something like that but that also runs Gulp before redeploying.
I've running Gulp from command line and seeing if IntelliJ would pick up the changes, but instead the Tomcat running in IntelliJ crashes with a bunch of these
23-Nov-2015 12:28:53.518 SEVERE [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor /Users/jkirby/Library/Caches/IntelliJIdea15/tomcat/app1,_app2,_app3,_app4,_app5,_app6_(1)_cumulus/conf/Catalina/localhost/site.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/site]]
Use Gulp watch instead of making Intellij run custom scripts on redeploy. As far as I can tell, it is not possible to run custom scripts when re deploying (CommandShiftF9)
If you want to give it a try, here is a related SO article on how to set it up: How to Gulp-Watch Multiple files?

Resources