Stryker: Add the ability to add gitignored files inside the config: files

Created on 20 Jun 2019  路  18Comments  路  Source: stryker-mutator/stryker

Summary

Here:
https://github.com/stryker-mutator/stryker/tree/master/packages/core#files-string

I would like to be able to add my translation files that are gitignored. I run a command to update them.

馃殌 Feature request

Most helpful comment

then I reopen (but it can stay in the deep bottom of the backlog) 馃槅

All 18 comments

Hi @trollepierre thanks for opening this issue.

I think you linked the correct stryker option. With https://github.com/stryker-mutator/stryker/tree/master/packages/core#files-string you can override the default behavior of ignoring certain files.

Or is there some other feature you're requesting here?

Can you please give an example how to do add every file, except gitignored files, but with one exception file that is ignored?

I didn't succeed in doing it. :S

Can you please give an example how to do add every file, except gitignored files, but with one exception file that is ignored?

I see... this isn't possible at the moment, no. You would need to add glob expressions for all files you want to add explicitly.

I've added the feature tag to this issue. How would you expect us to support this (without a breaking change)? We could add a flag like fileResolvingStrategy... or add a magic string constant that you need to put as first in the files array, like !!gitfiles or something, both not ideal.

I've added the feature tag to this issue.
Where?

How would you expect us to support this (without a breaking change)?
Adding a flag like fileResolvingStrategy would be the simplest solution to me.

Optional values would match:

  • all files => all
  • all gitfiles => gitfiles
  • custom (in that case, follow what is inside files

What do you think about it?

With the exception of your node_modules folder, what is in your .gitignore right now? You could also work by adding all files and then excluding what you don't want.

Also, why would you like to have a file in the sandbox that is not in your git repo? What kind of file (or files) are we talking about?

I am talking about the translation, that we get from an external service (Phraseapp).
The en.json and other language json are not committed during development. But are necessary to test the app.

I've got another suggestion.

NYC has a similair feature. It ignores node_modules by default, even if you override it with an exclude property. It than allows you to override this behavior using --exclude-node-modules=false.

We can do this as well by providing a --include-repository-files flag. @simondel do you agree? This keeps backward compatibility and make it nice and explicit. I'm open for naming suggestions.

I was happy with the suggestion at first sight, but I wonder how can we implement custom files. 馃

Example: I want to test every files in my .gitignore + my translation. (not more)

Moreover I am not a big fan of the naming. Using a script --include-repository-files=translations works, but what if I have other files?

@simondel :

what is in your .gitignore right now?

In my .gitignore, I have /.idea, *.log, coverage, several dist, .yarn.cache, .env

Moreover I am not a big fan of the naming. Using a script --include-repository-files=translations works, but what if I have other files?

I'm not sure if you understand me. This is what your stryker.conf.js would look like:

{
  includeRepositoryFiles: true,
  files: ['dist/*.translation.js']
}

So it would just be a flag to signal that you also want your repository files to be included.

@nicojs : ok I understand and i like this idea!

An out of the box idea, based on an older idea. Instead of whitelisting files, what about blacklisting? Allowing for a .strykerignore file. This is how prettier, eslint and other cool kids do it.

We might be able to use https://www.npmjs.com/package/glob-gitignore to do this.

We wouldn't rely on git anymore to do the file listing, which gives much more flexibility. We could still default to .gitignore, but enforcing the exact same functionality will be difficult, given that .gitignore files can add up (every directory can have one), this doesn't seem to be an out of the box feature of glob-gitignore

that would be better in my opinion!
Or more usable than the config idea

Is it still valid issue? we support files and git now.

I guess yes! (sorry to time to deep dive, in testing it)
Thanks

Pretty sure this issue isn't fixed yet :). But fine for me.

then I reopen (but it can stay in the deep bottom of the backlog) 馃槅

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicojs picture nicojs  路  17Comments

VincentLanglet picture VincentLanglet  路  31Comments

simondel picture simondel  路  25Comments

simondel picture simondel  路  17Comments

j-truax picture j-truax  路  20Comments