[BUG] Duplicated names in baseline.perf error after running 'reassure' the second time
Describe the bug After running 'reassure --baseline' on a base branch and then moving to another branch with changes and running 'reassure' there, i get this error:
Error while parsing file: .reassure/baseline.perf [ { "code": "custom", "message": "Your performance result file contains records with duplicated names.\n Please remove any non-unique names from your test suites and try again.", "path": [] } It's a bit odd what is happening. The first run 'reassure --baseline' is working well it seems, as it is producing the baseline.perf file in the .reassure folder. The second run of 'reassure' without the '--baseline' on the other branch with changes, still somehow produces changes to the same baseline.perf file and then it complains about duplicates, after it just added them there by itself. Shouldn't the second run of 'reassure' without the '--baseline' argument not touch the baseline.perf file? Why is it adding changes to the baseline.perf file and then complains about duplicates?
To Reproduce Steps to reproduce the behavior:
- run 'npx/pnpm reassure --baseline' on a branch (the baseline.perf is produced in the .reassure folder)
- change the branch and run 'npx/pnpm reassure'
- notice the baseline.perf file is changed again
- See error Error while parsing file: .reassure/baseline.perf [ { "code": "custom", "message": "Your performance result file contains records with duplicated names.\n Please remove any non-unique names from your test suites and try again.", "path": [] }
Expected behavior The second run of reassure without the '--baseline' argument should not alter the baseline.perf file again and then the error about the duplicates should go away by itself.
- OS: [macOS 15.3.2]
Can you share your .reassure/baseline.perf file?
sure. here's the baseline.perf on the first run on the base branch and the baseline.perf and current.perf after second run on the branch with changes.
thank you for the fast response
In the file baseline.perf - 2 - after pnpm reassure: you have two entries with the same name:
{"name":"BackButton performance"
{"name":"BackButton performance"
The name is take from test('name', ...) or it('name', ...) blocks in Jest.
Test names have to be unique. Otherwise, Reassure is not able to match tests from baseline and current.
Hi, thank you for answering.
i have a single test: "BackButton performance", in both branches. The first entry of "BackButton performance" is added to the baseline.perf file when running 'pnpm reassure --baseline' (see this state in baseline.perf - 1.. file) The second entry of "BackButton performance" is added to the baseline.perf file when running 'pnpm reassure' (see this state in baseline.perf - 2... file)
my main question is why is the baseline.perf file modified again (adding the test name again) when running pnpm reassure without the --baseline argument
your last statement is a bit confusing - about having unique test names in order to have reassure match them between baseline and current. shouldn't the test name stay the same exactly for this purpose, to identify the test between baseline and current?
again, thank you for your time. maybe i'm missing something about reassure's basic functionality
Could you check if you are not somehow interfering the output file selection?
1. Output file selection is Reassure CLI https://github.com/callstack/reassure/blob/672af33b6e7da17735979154bb57d556d73a47a9/packages/cli/src/commands/measure.ts#L44-L45
As you can see, the performance file is removed before the tests are actually run.
-
Passing output file to Jest through
REASSURE_OUTPUT_FILEenv Check if you are overriding env variable REASSURE_OUTPUT_FILE which is used to pass output file name to Jest test runner. -
Test config option outputFile option for
configure. By default it reads fromREASSURE_OUTPUT_FILEenv var.
I have the same problem. When I run npx reassure --baseline, the baseline.perf file is created normally. But when I run npx reassure, the current.perf file is created and the first line with the branch and commit info is added to it. However, the lines describing the tests are again being added to baseline.perf.