"test": "./node_modules/.bin/mocha --recursive -R xunit {testname}.js/ > test-report.xml"
~/tmp ɀ cat test.js
describe('Website UI', function() {describe('Logo', function() {it('was found', function() {});});});~/tmp ɀ mocha -R xunit test.js
<testsuite name="Mocha Tests" tests="1" failures="0" errors="0" skipped="0" timestamp="Wed, 10 Jun 2015 07:54:35 GMT" time="0.003"><testcase classname="Website UI Logo" name="was found" time="0.001"/></testsuite>~/tmp ɀ
describe('Website UI', function() {
it('check if elements exist', function() {
Class.{methodname}()});});
<testsuite name="Mocha Tests" tests="1" failures="0" errors="0" skipped="0" timestamp="Wed, 10 Jun 2015 07:54:35 GMT" time="0.003">
<testcase classname="Website UI Logo" name="was found" time="0.001"/>
logo element has been found
version element has been found
username element has been found</testsuite>
But instead the console.log prints out at the top of the xml file messing everything up.
I hope that makes more sense :-) thanks in advance!
describe('Website UI', function() {
it('displays logo', function() {return UIVerifier.verifyLogo();});it('displays copyright', function() {return UIVerifier.verifyCopyright();});});var UIVerifier = {verifyLogo: function() {return Q.Promise(function(resolve, reject) {setTimeout(function() {reject(new Error('Logo not found'));}, 100)});},verifyCopyright: function() {return Q.Promise(function(resolve, reject) {setTimeout(function() {resolve();}, 100)});}};var Q = require('q');
<testsuite name="Mocha Tests" tests="2" failures="1" errors="1" skipped="0" timestamp="Wed, 10 Jun 2015 10:30:03 GMT" time="0.223"><testcase classname="Website UI" name="displays logo" time="0.11"><failure><![CDATA[Logo not foundError: Logo not foundat null._onTimeout (/Users/vlad/tmp/test.js:15:16)at Timer.listOnTimeout (timers.js:110:15)]]></failure></testcase><testcase classname="Website UI" name="displays copyright" time="0.106"/></testsuite>
¹ this is probable more a xunit report format constraint than Mocha constraint
--
You received this message because you are subscribed to a topic in the Google Groups "Mocha" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mochajs/foz3ilI1qvo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mochajs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Glad to have been helpful, good luck! ;-)P.S. take a look at JSHint when you get a chance, it’s helpful in catching errors like that last one. ;-)
--