Включить имя файла в файл JUnit xml из Karma-JUnit-Reporter - PullRequest
0 голосов
/ 03 апреля 2020

Мне нужно найти способ включить имя файла, из которого был определен тест, в файл результатов JUnit XML. Он содержит только имя класса:

<testcase name="xxxTest should do Y." time="0.119" classname="Chrome_80_0_3987_(Mac_OS_X_10_12_6).xxxTest">

Существует опция classNameFormatter для передачи при создании конфигурации отчета в файле karma.conf.js, но не уверен, есть ли способ получить файл имя, использующее это?

// karma.conf.js

// the default configuration
junitReporter: {
  outputDir: '', // results will be saved as $outputDir/$browserName.xml
  outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
  suite: '', // suite will become the package name attribute in xml testsuite element
  useBrowserName: true, // add browser name to report and classes names
  nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
  classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
  properties: {}, // key value pair of properties to add to the <properties> section of the report
  xmlVersion: null // use '1' if reporting to be per SonarQube 6.2 XML format
}
...