如何在Typescript中的cypress上运行多个数据集作为testcase的参数
我想用Cypress上的数组对象构建的多个数据装置运行testcase。如下:, 我有一个错误,TS2345:type'(fixture:{name:string;sValue:string;eValue:string})=>void'不能分配给类型的参数(value:{name:string;sValue:string;eValue:string},索引:编号,数组:{name:string;sValue:string;eValue:string;}[])=>void'。有人知道为什么吗?,我做错了什么如何在Typescript中的cypress上运行多个数据集作为testcase的参数,typescript,mocha.js,cypress,typescript2.0,Typescript,Mocha.js,Cypress,Typescript2.0,我想用Cypress上的数组对象构建的多个数据装置运行testcase。如下:, 我有一个错误,TS2345:type'(fixture:{name:string;sValue:string;eValue:string})=>void'不能分配给类型的参数(value:{name:string;sValue:string;eValue:string},索引:编号,数组:{name:string;sValue:string;eValue:string;}[])=>void'。有人知道为什么吗?,我
const Fixtures = [
{
name: 'name1',
sValue: 'a',
eValue: '1',
},
{
name: 'name2',
sValue: 'b',
eValue: '2',
},
];
Fixtures.forEach(
(fixture: {
name: string;
sValue: string;
eValue: string;
}) => {
describe(`${fixture.name} test`, () => {
it(`set value ${fixture.sValue}`, () => {
...
});
it(`check ${fixture.name} on ${fixture.sValue}`, () => {
...
});
it('check test4', () => {
...
});
it('check testcase 5', () => {
...
});
});
}
);
forEach()
有一个带有3个参数的签名,(值、索引、数组)
。这可能是类型定义中的错误,但看起来它希望指定所有3个。您可能只需将它们键入任意(fixture:{…},index:any,array:any[])=>
。即使我的fixture是对象,我也需要这样做?或者我可以忽略输入