Files
SCM-Manager/scm-ui/ui-components/src/storyshots.test.ts
2020-01-27 13:30:46 +01:00

23 lines
697 B
TypeScript

import path from "path";
import initStoryshots, { snapshotWithOptions } from "@storybook/addon-storyshots";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const createNodeMock = (element: any) => {
if (element.type === "tr") {
return {
// eslint-disable-next-line @typescript-eslint/no-empty-function
querySelector: (selector: string) => {}
};
}
};
initStoryshots({
configPath: path.resolve(__dirname, "..", ".storybook"),
// fix snapshot tests with react-diff-view which uses a ref on tr
// @see https://github.com/storybookjs/storybook/pull/1090
test: snapshotWithOptions({
// @ts-ignore types seems not to match
createNodeMock
})
});