I am using babel to transpile my JS using Aurelia framework but ES6 unit tests execute during the deployment process - I need them to run before we get to deployment so that I can validate or address issues beforehand. Anyone run into transpilation issues while trying to run js jasmine unit tests?
Related
There seem to be two approaches for invoking JUnit tests from the OS command shell:
java junit.textui.TestRunner <class-name>
and
java org.junit.runner.JUnitCore <class-name>
When do we use one versus the other?
Also, are there other ways to invoke Junit tests from the OS command shell?
JUnitCore is an entry point of JUnit - so if you want to run a test programmatically or of from some non-java script, I think, its the way to go for JUnit 4.
TestRunner is something a very old junit 3.x
Notice, that nowadays JUnit 5 is the latest available major release and it has yet another way to run the tests.
The question about different ways of running the tests from command line has been already answered Here so I can't add much to this.
However, I can comment on:
Also, are there other ways to invoke Junit tests from the OS command shell?
Nowadays in regular projects people do not run tests like this, instead they use one of build tools (Maven, Gradle for example) that among other things take care of tests.
So for example if you use maven, you can run mvn test and it will compile everything you need, including source code of tests, will take care about all test dependencies and will run all the tests with the help of build-in surefire plugin.
If you don't want to compile anything (assuming that all the code has been already compiled and all is set, you can use mvn surefire:test)
These build tools are also integrated with CI tools (like Jenkins, etc.) So this is considered to be a solved problem.
So unless you're doing something really different (like writing the IDE UI that should run test selected by user on demand or something) there is no really need to run tests with the options you've mentioned.
I use a gulp task to run my node.js unit tests, and a VSCode task to execute this gulp task. Now I'd like to debug my tests. Unfortunately, VSCode ignores break points when running the task. Apparently it uses the default run mode instead of the debug mode when starting a task.
Is there a way to tell VSCode to execute a task in debug mode?
Here is an example for mocha tests: https://gist.github.com/paambaati/54d33e409b4f7cf059cc#gistcomment-1835655
In other cases you have to create a launch.json to debug you code. In this configuration you can set the preLaunchTask property to the name of your gulp task. If your task is configured as isWatching you might also need to configure a problemMatcher otherwise the task will not allow the debugger to start before the task ends.
I have added npm task to install all my dependencies in bamboo. This command is working successfully. Now I want add gulp task. I have added nodeJS addon in my bamboo plan. Using this I want to execute the gulp command (e.x : gulp minify). I am not able to find the way how to execute this command. Can someone please help me to resolve this issue.
The Bamboo Node.js Support add-on you referenced features a dedicated Gulp task. I think it is shipped alongside newer versions of Atlassian Bamboo at least, maybe you need a newer version?
The Node.js Bamboo Plugin (Bitbucket) page explains how to Configure dependencies and install modules for it to work:
Add the following dependencies (or devDependencies) to the
package.json file in your Node.js project. These are required if you
want to use the "Grunt 0.4.x", "Gulp", "Bower", "Nodeunit" or "Mocha
Test Runner" tasks.
...
Gulp
gulp (v3.3.2 or newer recommended)
...
For my current project I use Grunt as a full-deploy system. Checking/compiling all assets, cleaning cache, and deploying database. Now I am looking at Gulp.js. Everyone says, it has much more readable configuration file and it executes a bit faster. The only thing is missing for me - database deployment. With Grunt, I am using grunt-deployments package. Is there something like that for Gulp? Or should I write my own package?
Gulp is a build system. Build and Deploy are separate sets of activities. Steaming is good for building lots of smallish files like in an assembly line in manufacturing. For deployment, synchronous code (nodejs is not good at synchronous, atleast until v0.12) is good.
I use powershell(windows) or shell/chef/ansible(linux) for deployment/setup/etc, which call gulp for building assets pipeline.
Gulp is mostly targeted towards assets pipeline in other tech-stacks, and full build system for node-js techstack.
However, If you have only trivial deploy tasks, then consider using async.series() from async package and use regular node-js code to do the deployments. Accept and call the done callback when you are done in the gulp task.
I'm trying to fix our messy failing test runs, and, unfortunately, I'm very new to gradle. We currently have testng, junit, and I'd like to add some spock tests to the mix as well. I'm not quite sure how gradle determines which tests to run when I type "gradle test". How can I prevent the testng &/or junit tests from running? How can I get gradle to start running my spock tests?
By default, the test task runs all JUnit tests it can find, which includes any Spock tests. To make it run TestNG tests instead, configure the task as follows:
test {
useTestNG()
}
If you have both JUnit and TestNG tests, you need two test tasks, one for each test framework.
To run a subset of tests, use the -Dtest.single system property. For more information, see the corresponding section in the Gradle User Guide.
You may provide using the command line:
$> gradle test --tests org.somewhere.MyTestClass
Or even
$> gradle test --tests org.somewhere.MyTestClass.my_test_case
$> gradle test -Dtest.single=YourTestClass