Skip to content

Fix update-test-outputs script to use test-specific prettier options. - #741

Merged
jtkiesel merged 1 commit into
jhipster:mainfrom
motlin:update-test-outputs
Jul 6, 2025
Merged

Fix update-test-outputs script to use test-specific prettier options.#741
jtkiesel merged 1 commit into
jhipster:mainfrom
motlin:update-test-outputs

Conversation

@motlin

@motlin motlin commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Before this change, checking out the project and running update-test-outputs would make changes to the test outputs.

❯ npm run build && npm run update-test-outputs
❯ git status
HEAD detached at upstream/main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   packages/prettier-plugin-java/test/unit-test/binary_expressions/operator-position-start/_output.java
        modified:   packages/prettier-plugin-java/test/unit-test/require-pragma/invalid-pragma/_output.java

no changes added to commit (use "git add" and/or "git commit -a")

The change here is to use the test-specific configuration while recording tests. With this change, running npm run update-test-outputs doesn't make any changes to any files.

@jtkiesel jtkiesel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution! It will certainly make testing the printer much easier during development. I added a couple suggestions for minor improvements, let me know what you think.

Comment thread packages/prettier-plugin-java/scripts/update-test-output.js Outdated
@motlin
motlin force-pushed the update-test-outputs branch from c3660c5 to 86c10f7 Compare July 6, 2025 03:53
@motlin

motlin commented Jul 6, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I think I addressed your points by renaming the files to .prettierrc.json and by removing the prettierOptions parameter in favor of always loading .prettierrc.json instead.

@jtkiesel jtkiesel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick changes and the rebase! It looks great. 👍

@jtkiesel
jtkiesel merged commit a90cfa3 into jhipster:main Jul 6, 2025
@motlin
motlin deleted the update-test-outputs branch July 6, 2025 14:12
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.

2 participants