2019-10-20 16:59:02 +02:00
|
|
|
import path from "path";
|
2020-01-06 14:48:32 +01:00
|
|
|
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) => {}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
2019-10-19 16:38:07 +02:00
|
|
|
|
|
|
|
|
initStoryshots({
|
2020-01-06 14:48:32 +01:00
|
|
|
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({
|
|
|
|
|
createNodeMock
|
|
|
|
|
})
|
2019-10-19 16:38:07 +02:00
|
|
|
});
|