stryker-js icon indicating copy to clipboard operation
stryker-js copied to clipboard

Data structure modifications

Open magwas opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Stryker is unable to generate mutants in code building data structures, e.g. a typical reducer.

Describe the solution you'd like When a data structure is built, some fields could be set to random values. Ideally all of them in different mutants.

Describe alternatives you've considered

  • deleting existing assignments might be easier, but I do not consider it full coverage
  • another solution for a project going for 100% mutation coverage could be to ban this kind of constant building, and require algorithmic solutions which stryker can mutate

Additional context

This needs the type information. Do stryker still have it in the mutator? If not, what would be the way to actually have it?

Stryker could not introduce any mutant in this code:

export function clearSelectedHeroTransition(
  state: AppState): AppState {
  return {
    ...state,
    componentstates: {
      ...state.componentstates,
      heroeditor: initialState.componentstates.heroeditor
    }
  };
}

magwas avatar Feb 08 '23 06:02 magwas

Hi @magwas 🙋‍♂️. Thanks for this issue!

What mutants would you want in your code example? Would these 2 work for you?

export function clearSelectedHeroTransition(
  state: AppState): AppState {
  return {
-    ...state,
    componentstates: {
      ...state.componentstates,
      heroeditor: initialState.componentstates.heroeditor
    }
  };
}
export function clearSelectedHeroTransition(
  state: AppState): AppState {
  return {
    ...state,
    componentstates: {
-      ...state.componentstates,
      heroeditor: initialState.componentstates.heroeditor
    }
  };
}

If so, then I think we should be able to mutate the SpreadElement here.

image

nicojs avatar Feb 10 '23 08:02 nicojs

That would be a nice partial solution. I would like to see all lines mutated actually.

magwas avatar Mar 07 '23 06:03 magwas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '24 11:03 stale[bot]