-
Notifications
You must be signed in to change notification settings - Fork 251
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
feat(.gitignore): add Stryker patterns to .gitignore file during initialization #1848
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome addition. Please look at my remarks. 👍
|
||
public async addStrykerTempFolder() { | ||
if (fsAsPromised.existsSync(GITIGNORE_FILE)) { | ||
const strykerTempFolderSpecification = `${os.EOL}# stryker temp files${os.EOL}*.stryker-tmp${os.EOL}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please define '.stryker-tmp'
as a const to be reused (from @stryker-mutator/api/config
), making it DRY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: running stryker init multiple times will result in multiple rules being added to your .gitignore file. We can do a simple if(!gitignoreContent.endswith(strykerTempFolderSpecification)
to prevent this. Not really necessary maybe, but nice none the less.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why *.stryker-tmp
instead of .stryker-tmp
?
@@ -52,6 +53,7 @@ describe(StrykerInitializer.name, () => { | |||
.provideClass(initializerTokens.npmClient, NpmClient) | |||
.provideValue(initializerTokens.strykerPresets, presets) | |||
.provideClass(initializerTokens.configWriter, StrykerConfigWriter) | |||
.provideClass(initializerTokens.gitignoreWriter, GitignoreWriter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this will result in the real one being included. Please use a mocked GitingoreWriter
and test that it is called correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Let's do this!
Fixes #1683