Jasmine tests through bamboo? - node.js

I would like to integrate the jasmine tests with bamboo, but I'm not sure is it possible.
The best what I found so far is https://bitbucket.org/atlassian/bamboo-nodejs-plugin which support just mocha tests. I would like to know is there any way to change node-jasmine output to be compatible with bamboo.
Thanks

Resolved:
Using option --junitreport and than use that report in bamboo to show the results,

This is 3 years too late, but hopefully it can help some other people aswell.
For Karma you can use karma-junit-reporter npm package.
install it and add this to your Karma config file
config.set({
reporters: ['progress', 'junit'],
...
Then you can run your test and it will generate a JUnit xml file.
Use the JUNIT parser in bamboo and read this file. It should pick up your tests then.

Related

Install and run #cucumber/cucumber in Node.JS

We want to use Cucumber in our Node.JS project. It's probably a pretty basic question but I'm following the Cucumber tutorial and I'm getting stuck at the part where you have to run Cucumber in order to test if everything works. How do I run the new Cucumber (#cucumber/cucumber) package? I think that my issue is related to the package change, which is now /#cucumber/cucumber instead of just cucumber. The command ./node_modules/.bin/cucumber-js -f node_modules/cucumber-pretty doesn't work. Furtermore, what does -f means?

Why when test fails jenkins still says success?

I have a MEAN project. Using Jenkins on an EC2 machine I build this using the following shell script:
npm install && PORT=8888 npm test
mocha returns 2 (number of failing tests) but still jenkins says:
Finished: SUCCESS.
If tests are failing I expect to see
Finished: FAILURE
Do you know why its not working fine?
You can:
Use a test runner like Karma, or
Tell Mocha to report in, for example, XUnit format, by passing Mocha the --reporter xunit flag. XUnit closely aligns with JUnit which Jenkins understands, or
Add in a custom reporter — mocha-jenkins-reporter is a decent option.
In the end I used a different solution: installed Jenkins Text Finder and if "expected - actual" is found in log (test failed), I let this plugin to mark the build as "Unstable".

Debugging protractor tests from the console

I have a protractor test run via gulp-protractor. How can I debug this test using the command line (for example via the node debugger)?
Is there a configuration option for this?
Recently (as of Protractor 5.0.0) the recommended way to do this has become browser.enterRepl().
Starting from protractor documentation:
https://github.com/angular/protractor/blob/master/docs/debugging.md
browser.debugger() and browser.pause() should be help.

Karma mocha and jscoverage

We have an application written in coffee-script with node.js and are struggling to set up code coverage tools.
At the moment we have code-coverage up and running for the serverside with
coffeeCoverage
jscoverage
mocha
The front end unit tests are functions with the karma test runner and mocha, and working well. But I just can't seem to find a way to get the same kind of output from karma.
Here is the command being used for the serverside:
mocha --compilers coffee:coffee-script --require chai --reporter html-cov --recursive test/mocha > coverage.html
it would seem that because the front end is also in mocha and coffee-script we should be able to do the same thing there. But karma does not support the html-cov reporter, and that has left me at somewhat of a dead end.
The ideal path is that karma would run like normal in phantomjs and use the mocha html-cov reporter to output an html file. Does anyone know were to go from here?
Here is a portion of my Cake task for the serverside just for reference.
karma-coverage plugin uses Istanbul to instrument the source files and generate the coverage reports.
There's a pending issue to enable the same for coffee script too https://github.com/karma-runner/karma/issues/622
I highly recommend switching from jscoverage to istanbul to calculate your code coverage. istanbul supports mocha (be sure to call _mocha) and is the default code coverage tool for karma. Details here: Code coverage with Mocha

using Blanket.js for a compoundjs app to generate coverage report

I have compoundjs application in which I have used the scaffold generator to generate controller and its test cases. The test cases are running correctly. But I need to generate the code coverage report for the same. I am trying to use blanket.js for the same.
I have configured blanket.js like this in package.json in scripts :
"blanket": { "pattern": "app" }
app is the folder which contains all my controllers, models etc. And then I am running test cases having reporter as :
mocha test/init.js test/controllers/sample_controller.test.js --require blanket -R html-cov > coverage.html
This is actually properly generating coverage report for it. But the problem I am facing is it is only showing the code coverage for certain files like it is showing code coverage for model/sample but not for controllers/sample_controller.js.
Please help me out ASAP as I am actually stuck with it.
Thanks a lot in advance,
Option 1: Try using _mocha instead of mocha to avoid mocha forking and not covering all of your code in the same process.
Option 2: I highly recommend istanbul as a coverage tool. Try:
npm -g install istanbul
istanbul cover _mocha -- test/init.js test/controllers/sample_controller.test.js --require blanket -R spec
open coverage/lcov-report/index.html
More info here: https://github.com/gotwarlost/istanbul/issues/44
These are eval controllers, right? I'm investigate coverage for eval controllers in the next release of Blanket (v1.1.3). In the meantime Istanbul is an option, as is grunt-blanket.

Resources