Before extending the unexpected instance with new functionality it is usually a good idea to clone it, so you don't change the global instance. You do that by calling the clone method.

Adding new functionality to the cloned instance will not affect the original instance:

const clonedExpect = expect
  .addAssertion('<number> to be an integer', function (expect, subject) {
    expect(Math.round(subject), 'to be', subject);
clonedExpect(42, 'to be an integer');

If we try to use the new assertion on the original instance it fails:

expect(42, 'to be an integer');
Unknown assertion 'to be an integer', did you mean: 'to be infinite'