Stryker: Using the configuration option `commandRunner`

Created on 3 Jul 2020  ยท  5Comments  ยท  Source: stryker-mutator/stryker

Question

I'm trying to configure a different command by adding the following to an existing stryker.conf.json

{
  ...,
  "commandRunner": {
    "command": "npm run mocha"
  }
}

as is documented in the readme and the schema

I also looked at the schema whether it indicates where to put that new attribute, but it's missing in the schema.

I searched the issues and only found examples of adding the option to a javascript config file.

Did I miss something? Can somebody help me to understand how to properly configure the command to run?

(And if it is or should be possible to do that with a JSON config file, should the correct location be part of the schema?)

Stryker environment

โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ”‚ โ”œโ”€โ”€ @stryker-mutator/[email protected]
โ”œโ”€โ”ฌ @stryker-mutator/[email protected]
โ‰ Question

Most helpful comment

Yeah not sure either, somebody call Bill Gates to report this issue, please ๐Ÿ“ž

I've released the fix under version 3.3.1

All 5 comments

as is documented in the readme

When I tried this change to stryker.conf.json in my xmldom workarea, according to that section of the readme:

--- a/stryker.conf.json
+++ b/stryker.conf.json
@@ -9,6 +9,9 @@
     "dashboard"
   ],
   "testRunner": "command",
+  "commandRunner": {
+    "command": "npm run ttt"
+  },
   "transpilers": [],
   "dashboard": {
     "project": "github.com/brodybits/xmldom",

it gave me the following:

03:41:46 (45427) INFO ConfigReader Using stryker.conf.json
03:41:46 (45427) WARN markUnknownOptions Unknown stryker config option "commandRunner".
03:41:46 (45427) WARN markUnknownOptions 
   Possible causes:
   * Is it a typo on your end?
   * Did you only write this property as a comment? If so, please postfix it with "_comment".
   * You might be missing a plugin that is supposed to use it. Stryker loaded plugins from: ["@stryker-mutator/*","/Users/brodybits/dev/xmldom/node_modules/@stryker-mutator/core/src/reporters/index.js"]
   * The plugin that is using it did not contribute explicit validation. 
   (disable "warnings.unknownOptions" to ignore this warning)
03:41:46 (45427) INFO InputFileResolver Found 4 of 43 file(s) to be mutated.
03:41:46 (45427) INFO InitialTestExecutor Starting initial test run. This may take a while.
03:41:49 (45427) ERROR InitialTestExecutor One or more tests failed in the initial test run:
    All tests
        npm
 ERR! missing script: ttt

I think this means that there is something missing in the JSON schema, which is just a warning, but then something else does pick up the custom test command with npm run ttt, which is self-evident in the InitialTestExecutor error message.

I think it should be possible to continue with the custom runner command and ignore the warning for now.

I would definitely call this a minor bug somewhere in the Stryker JSON validation, which has unfortunate consequence for newcomers.

Very true @brodybits . We've recently refactored our options validation and added this warning. We didn't even know how many config options we'd accumulated over the years ๐Ÿ˜…. Apparently we've forgotten about commandRunner options.

Thx for the quick and helpful replies!
Not sure why the issue was not closed already since the PR has "Fixes #this" in it, but I think it can be closed.

Yeah not sure either, somebody call Bill Gates to report this issue, please ๐Ÿ“ž

I've released the fix under version 3.3.1

FYI this was fixed by: fb89a31a5255a9ad2a7828acf1eac9cb9eb6270f - part of 3.3.1 release

(It looks like there is no "fixes" or "closes note in fb89a31a5255a9ad2a7828acf1eac9cb9eb6270f)

I am adding this comment for quick reference in the future, not trying to spam:)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeznag picture jeznag  ยท  17Comments

trollepierre picture trollepierre  ยท  18Comments

Lakitna picture Lakitna  ยท  42Comments

wolf-off picture wolf-off  ยท  18Comments

Zorin95670 picture Zorin95670  ยท  18Comments