Proper way to configure the diff per expect test

I have some expect tests that filter out random elements from the output stream before executing my tests. Unfortunately, because the random elements vary in size, the formatting of the output may carry over to another line or not, making the expect test randomly fail.

Researching a solution, I noticed that patdiff has a -keep-whitespace flag which is by default on in dune. If I could easily configure ideally some or all of my tests to disable keep-whitespace, that would be incredibly useful to me. Eg.

let%expect_test ~keep_whitespace:false "my whitespace insensitive test" =


let%expect_test "my whitespace insensitive test" =
[%expect ~keep_whitespace:false {|< unwieldly output >|}]

At the moment however, it is not clear at all how I “correctly” modify my test harness to alter the diff algorithm’s behavior. Is creating a ~/.patdiff the only feasible way now? Or should one override the diff command itself used by dune / ppx_inline_test?

Thanks in advance for any advice, including completely alternative ways of dealing with this type of situation.