tornaia / karma-sonarqube-unit-reporter

A Karma plugin. Unit tests execution report for SonarQube/Generic Coverage Plugin
MIT License
33 stars 28 forks source link

Unexpected output to stdout #24

Closed rodneyrehm closed 4 years ago

rodneyrehm commented 6 years ago

Hey there!

when loading this plugin I get thousands of messages of the following format written to stdout:

-- describe: ${description} -> file: ${file}

I'm currently using the following plugins and expected only to see spec reports on screen:

{
  reporters: ['spec', 'coverage', 'sonarqubeUnit'],

  sonarQubeUnitReporter: {
    sonarQubeVersion: 'LATEST',
    outputFile: 'reports/sonarqube.xml',
    useBrowserName: false,
    // overrideTestDescription: true,
    // testPath: './test',
    // testFilePattern: '.spec.js',
    // replicating the reporter's internal only to add a path prefix:
    // https://github.com/tornaia/karma-sonarqube-unit-reporter/blob/master/index.js#L196-L208
    filenameFormatter: (nextPath, result) => {
      const testPath = './test'
      const testFilePattern = '.spec.js'
      const filesForDescriptions = fileUtil.getFilesForDescriptions(testPath, testFilePattern)
      const filePath = filesForDescriptions[nextPath]
      return 'frontend/' + filePath
    },
  },
}

any idea where things could be going wrong?

rodneyrehm commented 6 years ago

I moved the call fileUtil.getFilesForDescriptions() to the top and now get the the output only once. good enough for now…

But I assume you'd like to replace the console.log in file-utils.js to write to the logger created for the plugin instead?