Plugins 使用cypress插件快照返回。toMatchSnapshot不是一个函数

Plugins 使用cypress插件快照返回。toMatchSnapshot不是一个函数,plugins,snapshot,cypress,Plugins,Snapshot,Cypress,我正在尝试使用cypress插件快照来拍摄JavaScript对象的一些快照 我已经按照上的Configure Cypress.io说明进行了操作,但是当我运行下面的测试时,我收到了以下错误 1检查快照是否应与快照匹配: TypeError:expectedData.toMatchSnapshot不是函数 在上下文中。https://www.bbc.com/__cypress/tests?p=cypress/integration/data_driven.js-917:24:18 我的测试文件是

我正在尝试使用cypress插件快照来拍摄JavaScript对象的一些快照

我已经按照上的Configure Cypress.io说明进行了操作,但是当我运行下面的测试时,我收到了以下错误

1检查快照是否应与快照匹配: TypeError:expectedData.toMatchSnapshot不是函数 在上下文中。https://www.bbc.com/__cypress/tests?p=cypress/integration/data_driven.js-917:24:18

我的测试文件是:

describe('Check snapshots', function () {
    it('Should match snapshot', () => {
    const expectedData = {
      fonts: 
       [ { familyName: 'Helvetica', isCustomFont: false, glyphCount: 10 },
         { familyName: 'Gurmukhi MN', isCustomFont: false, glyphCount: 33 } ]
    }

      expectedData.toMatchSnapshot();
    });
  });

我对JS和Cypress都比较陌生,所以我不确定我到底做错了什么。如果有人有解决这一问题的经验,我将非常感谢您的意见。

您只需用expect:

expectedData.toMatchSnapshot
非常感谢你,我真的很感激。