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

feat(.gitignore): add Stryker patterns to .gitignore file during initialization #1848

Merged
merged 6 commits into from
Dec 11, 2019

Conversation

simondel
Copy link
Member

Fixes #1683

Copy link
Member

@nicojs nicojs left a 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}`;
Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

@nicojs nicojs left a 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!

@nicojs nicojs merged commit 854aee0 into master Dec 11, 2019
@nicojs nicojs deleted the 1683-add-tempfolders-to-gitignore branch December 11, 2019 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As part of Init, add .styrker-tmp folders to gitignore
2 participants