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 @@ -329,6 +329,34 @@ else
329
329
end
330
330
end
331
331
332
+ # Handle `mvn jasmine:test` report
333
+ #
334
+ # Example:
335
+ # <testsuite errors="0" name="jasmine.specs" tests="22" failures="3" skipped="0" hostname="localhost" time="0.0" timestamp="2017-03-09T19:52:06">
336
+ # <testcase classname="jasmine" name="CatalogUtils.expandNumbers() should return string without hyphen as it" time="0.0" failure="true">
337
+ # <error type="expect.toEqual" message="Expected 'test' to equal '2test'.">Expected 'test' to equal '2test'.</error>
338
+ # </testcase>
339
+ # </testsuite>
340
+ #
341
+ jasmine_report = 'target/jasmine/TEST-jasmine.xml'
342
+ unless File . file? ( jasmine_report )
343
+ warn ( "Couldn't find #{ jasmine_report } . jasmine-maven-plugin results is unknown" )
344
+ else
345
+ doc = Nokogiri ::XML ( File . open ( jasmine_report ) )
346
+ testsuite = doc . xpath ( '/testsuite' ) . first
347
+ failures = testsuite [ 'failures' ] . to_i
348
+ if failures > 0
349
+ testsuite . xpath ( './/testcase[@failure="true"]' ) . each do |tc |
350
+ # NOTE: unfortunately jasmine report doesn't contain file name
351
+ msg = tc . xpath ( './error' ) . first . text . sub ( /\. $/ , '' )
352
+ testcase = tc [ 'name' ]
353
+ fail ( "jasmine-maven-plugin error:\n Test case `#{ testcase } ` fails with message:\n `#{ msg } `\n " )
354
+ end
355
+
356
+ print_errors_summary 'jasmine-maven-plugin' , failures , 'https://github.com/php-coder/mystamps/wiki/unit-tests-js'
357
+ end
358
+ end
359
+
332
360
# Handle `html5validator` output
333
361
#
334
362
# Example:
You can’t perform that action at this time.
0 commit comments