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

Support interpolating {base} in JUNIT env settings #29

Merged
merged 9 commits into from
Jun 14, 2024
Merged

Conversation

pbrisbin
Copy link
Member

@pbrisbin pbrisbin commented Jun 13, 2024

There are a few pre-factor commits, this is the main one: c355987

In a monorepository of multiple packages using JUnit, there is no way*
(via ENV configuration) to avoid each package overwriting the lasts test
file, since anything you set will be used uniformly by all the test
suites, as they are a single process.

By adding a very simple interpolation of {base} by the basename of the
current directory, this can be avoided without resorting to in-code
configuration by setting something like JUNIT_OUTPUT_NAME={base}.xml.

Arguably, that would be a better default than the current junit.xml,
but moving to that would be a breaking change, and incorporating
{base} generally through all the settings feels useful anyway.

*That is, while also using a custom directory. It does Just Work with defaults because
./junit.xml is actually package-local already. It's only when you try to change
the directory to (e.g.) /tmp/junit that there's no way to prevent the collision
without being able to incorporate that package name somewhere.

pbrisbin added 5 commits June 13, 2024 09:10
This was best accomplished by extracting a pure function to test with.
In a monorepository of multiple packages using JUnit, there is no way
(via ENV configuration) to avoid each package overwriting the lasts test
file, since anything you set will be used uniformly by all the test
suites, as they are a single process.

By adding a very simple interpolation of `{base}` by the basename of the
current directory, this can be avoided without resorting to in-code
configuration by setting something like `JUNIT_OUTPUT_NAME={base}.xml`.

Arguably, that would be a better default than the current `junit.xml`,
but moving to that would be a breaking change, and incorporating
`{base}` generally through all the settings feels useful anyway.
@pbrisbin pbrisbin changed the title pb/interpolate Support interpolating {base} in JUNIT env settings Jun 13, 2024
@pbrisbin pbrisbin requested a review from chris-martin June 13, 2024 13:57
@pbrisbin pbrisbin marked this pull request as ready for review June 13, 2024 13:57
@pbrisbin pbrisbin enabled auto-merge (rebase) June 13, 2024 14:05
@pbrisbin pbrisbin merged commit 2e89354 into main Jun 14, 2024
12 checks passed
@pbrisbin pbrisbin deleted the pb/interpolate branch June 14, 2024 12:54
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