How do i fix DEPRECATION: The matcher factory for "toHaveBeenTriggeredOnAndWith"?

Viewed 665

Can anyone tell me what needs to be changed this test?

  it('Should update settings of bar', () => {
    const newSettings = {
      dataset: [
        {
          data: [{
            name: 'Category A',
            value: 373,
            color: '#1D5F8A',
            id: 1
          }],
          name: ''
        }
      ]
    };

    barObj.updated(newSettings);
    const dataLength = barObj.settings.dataset[0].data.length;

    expect(dataLength).toEqual(1);
  });

I am getting this error from Jasmine and if i follow the link https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#matchers-cet i dont see exactly what i would need to change?

ERROR: 'DEPRECATION: The matcher factory for "toHaveBeenTriggeredOnAndWith" accepts custom equality testers, but this parameter will no longer be passed in a future release. See https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#matchers-cet for details. (in spec: Bar API Should update settings of bar)

I also cant find a lot of information about this message. I also dont have any custom equality matchers in the system. https://jasmine.github.io/tutorials/custom_equality

2 Answers

Try to update karma-jasmine package. It helped me.

I had this problem using "@metahub/karma-jasmine-jquery". You can modify the bundle in place and remove the second parameter from the `` toHaveBeenTriggeredOnAndWith" function. Or copy the module somewhere, uninstall "@metahub/karma-jasmine-jquery" and install the modified module: npm install ./@metahub/karma-jasmine-jquery

Related