-
Notifications
You must be signed in to change notification settings - Fork 252
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
Add the ability to add gitignored files inside the config: files #1593
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 |
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 |
Optional values would match:
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). |
I've got another suggestion. NYC has a similair feature. It ignores node_modules by default, even if you override it with an We can do this as well by providing a |
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? |
In my .gitignore, I have /.idea, *.log, coverage, several dist, .yarn.cache, .env |
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 We might be able to use https://www.npmjs.com/package/glob-gitignore to do this. We wouldn't rely on |
that would be better in my opinion! |
Is it still valid issue? we support |
I guess yes! (sorry to time to deep dive, in testing it) |
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) 😆 |
I want to implement this feature ( |
Add the ability to specify `ignorePatterns` in your Stryker configuration. This replaces `files` option which is now deprecated. By specifying `ignorePatterns` you choose which files should not be copied to the Sandbox directory (inside the `.stryker-tmp` directory). This effectively excludes them from being used during mutation testing. For example: ```json { "ignorePatterns": ["dist"] } ``` This will discover all files in your current working directory, _except_ for files matching the `"dist"` pattern. Stryker uses [.gitignore](https://git-scm.com/docs/gitignore) rules to resolve these patterns. Stryker always adds `['.git', 'node_modules', '/reports', 'stryker.log', '.stryker-tmp']` when resolving these patterns. If you really want them in your sandbox, you can un-ignore them using a `!` prefix in your pattern, for example: ```json { "ignorePatterns": ["!node_modules"] } ``` The `ignorePatterns` is now also the default way files are discovered. Previously, Stryker used `git ls-files --others --exclude-standard --cached --exclude .stryker-tmp` to discover files by default. This had some limitations: * ❌ It only worked inside a git repository and you had to have `git` installed. If not, you got an error and had to use `files` * ❌ If a `.gitignore`'d file is needed to run your tests, you needed to fall back on `files`. Specifying `files` is now deprecated, but still works for the time being. Stryker will rewrite your file patterns internally to ignore patterns. Closes #1593 Closes #2739 BREAKING CHANGE: Stryker will no longer use a git command to determine which files belong to your project. Instead, it will rely on sane defaults. You can change this behavior by defining [`ignorePatterns`](https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string). BREAKING CHANGE: The `files` configuration option is deprecated and will be removed in a future release. Please use [`ignorePatterns`](https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string) instead. This: ```json { "files": ["foo.js"] } ``` Is equivalent to: ```json { "ignorePatterns": ["**", "!foo.js"] } ```
Closed with #2848 (please use |
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.
The text was updated successfully, but these errors were encountered: