Skip to content

Commit a78454d

Browse files
committed
some tests
1 parent fbc1f5f commit a78454d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed
761 Bytes
Loading
37.8 KB
Loading

packages/devextreme-cli/testing/app-template.test.shared.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,20 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
9797
const snapshotName = `${layout}-${theme}-${viewportName}-${name}-snap`;
9898
const snapshotPath = path.join(diffSnapshotsDir, `${snapshotName}.png`);
9999
const diffPath = path.join(diffSnapshotsDir, `${snapshotName}.diff.png`);
100-
100+
let compareResult = false;
101101
return compareImages({
102102
imageBuffer: image,
103103
snapshotPath,
104104
diffPath,
105105
threshold: overrideConfig.threshold ?? customConfig.threshold,
106106
}).then(({ equal, created }) => {
107-
expect(equal).toBe(true);
107+
expect(created).toBe(false);
108+
compareResult = equal;
108109
if (!equal) {
109110
throw new Error(`Image mismatch for "${snapshotName}". See diff at: ${diffPath}`);
110111
}
112+
}).finally(() => {
113+
expect(compareResult).toBe(true);
111114
});
112115
}
113116

packages/devextreme-cli/testing/utils/imageComparator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ async function compareImages({ imageBuffer, snapshotPath, diffPath, threshold =
3232
diff: diffPath,
3333
highlightColor: '#ff00ff', // pink
3434
}, () => {
35-
resolve({ equal: false });
35+
resolve({ equal: false, created: false });
3636
});
3737
} else {
38-
resolve({ equal: true });
38+
resolve({ equal: true, created: false });
3939
}
4040
});
4141
});

0 commit comments

Comments
 (0)