callstack / callstack/reassure

[FEATURE] Configurable output folder

Open
#569 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
38
PR merge metrics
No merged PRs in 30d

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:

https://github.com/callstack/reassure/blob/672af33b6e7da17735979154bb57d556d73a47a9/packages/cli/src/constants.ts#L1-L3

to something like

```tsx
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.

https://github.com/callstack/reassure/blob/672af33b6e7da17735979154bb57d556d73a47a9/packages/measure/src/config.ts#L18

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.