jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 244 forks source link

JUnit Formatter overwrites xml report when multiple test suites are in place #470

Closed sebastianzillessen closed 3 years ago

sebastianzillessen commented 8 years ago

I have multiple test suites, as my application has different main layouts with different javascript assets.

My configuration looks like this:

  config.suite do |suite|
    suite.matcher = "**/application/**/*_spec.{js,js.coffee,coffee}"
    suite.helper = File.expand_path("../javascripts/spec_helper_application.js", __FILE__)
    ...
  end
  # new config to run admin tests
  config.suite :admin do |suite|
    suite.matcher = "**/admin/**/*_spec.{js,js.coffee,coffee}"
    suite.helper = File.expand_path("../javascripts/spec_helper_admin.js", __FILE__)
  end
  FileUtils.mkdir_p(dirname = Rails.root.join("spec/reports"))
  config.formatters = ["dot", "junit>#{dirname.join("teaspoon.xml")}"]

The important part are the formatters. Having a look at teaspoon/lib/teaspoon/runner.rb#24 the Runner uses the same output file for each test-suite. In teaspoon/lib/teaspoon/formatter/base.rb#21 the Formatter::Base defines, that it will truncate existing files to zero length ("w": Write-only, truncates existing file to zero length or creates a new file for writing.). Hence, you will never see the output of all test-suites but only the last one.

Is there any configuration I missed, that could help me with that issue?

mathieujobin commented 3 years ago

looks like the patch for this was merged thank you