Repository navigation
[FEATURE] Configurable output folder #569
Description
Is your feature request related to a problem? Please describe.
We are configuring reassure in a monorepo containing many packages. We configured it in multiple packages. Each package has its own particularities and jest configuration, meaning they each have their respective reassure command.
We run these commands from the root of our monorepo. The problem is that since there's no way to configure an output folder, each package competes with the same .reassure/ folder at the root, making it difficult to run reassure across packages.
Let's say we change a shared util and want to measure its impact across the monorepo. We can't run the baseline, make the change, and then compare because the files in the .reassure/ folder get overridden after each reassure run in the different packages.
Describe the solution you'd like
Adding an environment variable called REASSURE_OUTPUT_FOLDER that works on the cli command and the measure packages.
The cli change might be as simple as changing a few lines here:
reassure/packages/cli/src/constants.ts
Lines 1 to 3 in 672af33
| export const RESULTS_DIRECTORY = '.reassure'; | |
| export const RESULTS_FILE = '.reassure/current.perf'; | |
| export const BASELINE_FILE = '.reassure/baseline.perf'; |
to something like
export const RESULTS_DIRECTORY = process.env.REASSURE_OUTPUT_FOLDER || '.reassure';
export const RESULTS_FILE = `${RESULTS_DIRECTORY}/current.perf`;
export const BASELINE_FILE = `${RESULTS_DIRECTORY}/baseline.perf`;For the measure package, it might conflict with the REASSURE_OUTPUT_FILE environment variable, requiring more refactoring.
reassure/packages/measure/src/config.ts
Line 18 in 672af33
| outputFile: process.env.REASSURE_OUTPUT_FILE ?? '.reassure/current.perf', |
Describe alternatives you've considered
We could also double down on the REASSURE_OUTPUT_FILE environment variable and make it work with the cli package.
Additional context
Such a configuration would allow us to set up a different output folder per package in our monorepo.
There might already be a way of doing this, but I couldn't find it. Let me know what you think and how I can help. I can even make a pull request if needed.
Activity
mdjastrzebski commentedon Mar 29, 2025
@100terres could you submit PR for this?
100terres commentedon Mar 31, 2025
@mdjastrzebski I can definitely look into it! Do you have a preferred way of approaching this?
mdjastrzebski commentedon Apr 18, 2025
The way you described in the issue (env variable) seems fine:
REASSURE_OUTPUT_DIRhuytdps13400 commentedon Aug 22, 2026
A fix is now open in #592.
REASSURE_OUTPUT_DIR is applied across the CLI, measure defaults, and comparison outputs so baseline.perf, current.perf, output.json, and output.md stay together in the configured package-specific directory. An explicit REASSURE_OUTPUT_FILE still takes precedence for measurement output.
The PR includes red/green tests, documentation, and a changeset. yarn validate and yarn build pass, and an end-to-end CLI probe created all four files under the custom directory.