仅当在it.each
块中使用代码时才会出现此错误
删除Me.tsx:
export const deleteMe = (inputVal: string): string => `this is function returning: ${inputVal}`;
删除Me.test.tsx:
import { deleteMe } from './deleteMe'; describe('simplest string matching', () => { it.each([['one'], ['two'], ['three'], ['four'], ['five'], ['six']])( 'matches snapshot fox input %s', (inputVal) => { expect(deleteMe(inputVal)).toMatchInlineSnapshot( `this is function returning: ${inputVal}`, ); }, ); });
运行yarn test -u
返回以下错误:
注:
-
如果一次运行一个测试而不是
it.each
,快照将正常更新 -
如果使用
toMatchSnapshot
而不是toMatchInlineSnapshot
,快照将正常更新 - 试图找到这里最好的方式