I figured this would be a really simple problem but I can't find an answer for it online.
So I have a variable that is created using a reference to a test object:
var param = testResults.results[1];
And I then want to override this variable's metrics
object as follows:
const new_mets = { key: {
k1: 100,
k2: 200
}
}
param.metrics = new_mets;
This all works fine and my test passes as expected BUT I have now found out that the underlying testResults.results[1]
is also being updated, which I don't want as I am referencing this in other tests.
Is there any means that I can just update my local params
variable without updating the underlying testResults
object?