2

I'm adding Stryker.net to my C# project. I see that it mutates on all log entries. Is there any way I can ignore these in the config?

psfinaki
  • 1,814
  • 15
  • 29
runnerpaul
  • 5,942
  • 8
  • 49
  • 118

2 Answers2

5

Depends on how your logging looks like, but most probably you can play with the ignore-methods option.

For example, dotnet stryker -im "['Logger.Log']" or even just dotnet stryker -im "['*Log']"

psfinaki
  • 1,814
  • 15
  • 29
  • Separate issue, but do you know if that option is available for other languages than .NET, as I do not see it in the documentation for Javascript, for instance. – Steven Scott Aug 26 '21 at 14:36
  • I don't know, from the docs doesn't seem so. You can ask in their [discussions](https://github.com/stryker-mutator/stryker-net/discussions) though, the guys are responsive. Also, please mark the answer as accepted if it helped. – psfinaki Aug 26 '21 at 15:23
  • I didn't ask the question, so I cannot accept it. I did ask the follow up question on slack. – Steven Scott Aug 26 '21 at 17:21
  • Or, I didn't notice a different nickname! Sorry. – psfinaki Aug 27 '21 at 06:09
1

The following is a valid solution, when for logging you are using the interface Microsoft.Extensions.Logging.ILogger<>.

Create a file named stryker-config.json in the root of your tests project. Populate it with the following:

{
  "stryker-config": {
    "ignore-methods": [
      "*LogCrititcal*",
      "*LogDebug*",
      "*LogError*",
      "*LogInformation*",
      "*LogTrace*",
      "*LogWarning*"
    ]
  }
}

This configuration will ignore the methods of the interface.