Null Pointer Exception When Parsing Mocha Results
I get the following NPE when running the Mocha parser:
2014-02-03 13:16:10,406 ERROR [pool-21-thread-1] [TestCollationServiceImpl] SCPWEB-KINETIC-JOB1-16: Failed to parse test result file "C:\bamboo-home\xml-data\build-dir\SCPWEB-KINETIC-JOB1\mocha.json"
java.lang.NullPointerException
at com.atlassian.bamboo.plugins.nodejs.tasks.mocha.MochaReportCollector.collect(MochaReportCollector.java:65)
at com.atlassian.bamboo.build.test.TestCollationServiceImpl$1$1.run(TestCollationServiceImpl.java:136)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
I've attached the result file (mocha.json) that it's attempting to parse.
It looks like the runner is looking for "skipped" tests but these do not exist in the file.
I'm using Mocha@1.12.0
Comments (4)
-
reporter -
reporter I've workaround this (kinda) by using the xunit reporter for mocha and the JUnit Parser in Bamboo.
Priority can be lowered since I've got a workaround.
-
The standard json reporter needed a slight massage, and didn't report things like the test duration, skipped tests (as you've noticed) and clear names of the tests, IIRC.
The bamboo-reporter plugin was written to use "fs" strictly as a convenience, to make it simpler to integrate with the tests, but it's pretty trivial to move it back to write to stdout as mentioned at https://github.com/metaskills/mocha-phantomjs/#third-party-reporters.
I personally had a use-case where some of the code being tested already wrote to stdout, so needed the distinction.
-
- changed status to resolved
Closing this ticket as it is quite outdated.
- Log in to comment
So it looks like I'm not using the mocha-bamboo-reporter (https://github.com/issacg/mocha-bamboo) which is why the problem is occuring.
Unfortunately, I'm having problems running third-party reporters with "mocha-phantomjs" https://github.com/metaskills/mocha-phantomjs/issues/81
Any reason why you're not supporting the standard "json" reporter for mocha?