Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to mutate files in place #2163

Closed
nicojs opened this issue Apr 24, 2020 · 1 comment · Fixed by #2706
Closed

Allow to mutate files in place #2163

nicojs opened this issue Apr 24, 2020 · 1 comment · Fixed by #2706
Labels
🚀 Feature request New feature request

Comments

@nicojs
Copy link
Member

nicojs commented Apr 24, 2020

Is your feature request related to a problem? Please describe.

There is a class of projects that do not play nice with Stryker's way of mutating files inside the sandbox (a subdirectory inside .stryker-tmp). We can spend a lot of time debugging the issues, going through the test runner issue tracker to create an issue, creating PR's/making noise to please fix our use case. Or we can allow files to be mutated in place.

List of issues that might be helped by such an option:
#2147
#1564
#717
#1957
#2185
#2274

Describe the solution you'd like

I would like to allow Stryker to mutate files "in-place". Meaning to not create a sandbox, but instead mutating the actual input files. I want mutation switching (#1514) to be implemented first, that way we can keep using parallel processes (since all mutants are in the code, we don't need to write every mutant to disk one by one).

We should be careful to warn users of the consequences. Some thoughts:

  • Enable this new functionality with a new cli flag --inPlace, or using a config file "inPlace": true, default is false.
  • When enabled, make a copy of the source code in a temp dir. Preferably in the os's temp dir instead of the current working directory.
  • After instrumentation, copy the instrumented files to the current working directory, instead of the sandbox file.
  • Set back the file's original content after Stryker is done.
  • Use a node exit hook to really make sure we allow us to set original files back.

Describe alternatives you've considered

What we've been doing until now is saying to everyone to fix the issue for us.

@nicojs
Copy link
Member Author

nicojs commented Jan 25, 2021

If you're looking at this issue after the fact: it is released in Stryker 4.4, see https://stryker-mutator.io/docs/stryker/configuration/#inplace-boolean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant