File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,34 @@ else
265
265
end
266
266
end
267
267
268
+ # Handle `mvn jasmine:test` report
269
+ #
270
+ # Example:
271
+ # <testsuite errors="0" name="jasmine.specs" tests="22" failures="3" skipped="0" hostname="localhost" time="0.0" timestamp="2017-03-09T19:52:06">
272
+ # <testcase classname="jasmine" name="CatalogUtils.expandNumbers() should return string without hyphen as it" time="0.0" failure="true">
273
+ # <error type="expect.toEqual" message="Expected 'test' to equal '2test'.">Expected 'test' to equal '2test'.</error>
274
+ # </testcase>
275
+ # </testsuite>
276
+ #
277
+ jasmine_report = 'target/jasmine/TEST-jasmine.xml'
278
+ unless File . file? ( jasmine_report )
279
+ warn ( "Couldn't find #{ jasmine_report } . jasmine-maven-plugin results is unknown" )
280
+ else
281
+ doc = Nokogiri ::XML ( File . open ( jasmine_report ) )
282
+ testsuite = doc . xpath ( '/testsuite' ) . first
283
+ failures = testsuite [ 'failures' ] . to_i
284
+ if failures > 0
285
+ testsuite . xpath ( './/testcase[@failure="true"]' ) . each do |tc |
286
+ # NOTE: unfortunately jasmine report doesn't contain file name
287
+ msg = tc . xpath ( './error' ) . first . text . sub ( /\. $/ , '' )
288
+ testcase = tc [ 'name' ]
289
+ fail ( "jasmine-maven-plugin error:\n Test case `#{ testcase } ` fails with message:\n `#{ msg } `\n " )
290
+ end
291
+
292
+ print_errors_summary 'jasmine-maven-plugin' , failures , 'https://github.com/php-coder/mystamps/wiki/unit-tests-js'
293
+ end
294
+ end
295
+
268
296
# Handle `html5validator` output
269
297
#
270
298
# Example:
You can’t perform that action at this time.
0 commit comments