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

Project "package.json" file is overwritten while running "test" #45

Closed
jacekk opened this issue Apr 5, 2020 · 2 comments
Closed

Project "package.json" file is overwritten while running "test" #45

jacekk opened this issue Apr 5, 2020 · 2 comments

Comments

@jacekk
Copy link

jacekk commented Apr 5, 2020

After migration from 1.1.1 to 1.3.0, running test task causes the project very package.json file to be overwritten by sth that jest-preset-coffeescript seems to be generating after last changes. Probably this one: b1dbe4f . Especially line 14 of jest-preset.coffee, where I can see fs.writeFileSync and package.json as the target file. I really doubt this is the expected behavior 🤔

Repo and branches comparison that reproduce the above issue: https://github.com/jacekk/jest-preset-coffeescript-override-issue-reproduce/compare/issue/jest-preset-coffeescript-1-3-0?expand=1

@jacekk jacekk changed the title Project "package.json" file is overwritten while running test Project "package.json" file is overwritten while running "test" Apr 5, 2020
@danielbayley
Copy link
Owner

@jacekk See #46 (comment)

@rposborne
Copy link

@danielbayley Not sure how #46 addesses this issue. It looks the file is using a relative path when loading the package json ( relative to jest-preset.cofffee but is writing to package.json which is unscoped and will write to the location where the node process originated from.

Long story short. https://github.com/danielbayley/jest-preset-coffeescript/blob/master/jest-preset.coffee#L14 will overwrite a projects package.json file. I would be happy to submit a PR but it is not clear why this code is here.

danielbayley added a commit that referenced this issue Oct 15, 2020
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

No branches or pull requests

3 participants