Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const allTestState = {
added: 0,
matched: 0,
unmatched: 0,
updated: 0,
obsolete: 0,
}
for (const group of filterStorybook(storybook, grep)) {
const filePath = path.resolve(`${configDir}`, `${group.kind}`);
console.log(chalk.underline(`${group.kind}`));
const fakeJasmine = {
Spec: () => {}
}
const state = jestSnapshot.getSnapshotState(fakeJasmine, filePath);
const snapshot = state.snapshot;
for (const story of group.stories) {
state.setSpecName(story.name);
state.setCounter(0);
const key = `${story.name}`
const hasSnapshot = snapshot.has(key);
const context = { kind: group.kind, story: story.name };
const tree = story.render(context);
const renderer = ReactTestRenderer.create(tree);
const actual = renderer.toJSON()
if (!snapshot.fileExists() || !hasSnapshot) {
// If the file does not exist of snapshot of this name is not present
// add it.
logState('added', story.name);