Skip to content

Commit 31482fe

Browse files
committed
add assertion
1 parent f0e9027 commit 31482fe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
104104
diffPath,
105105
threshold: overrideConfig.threshold ?? customConfig.threshold,
106106
}).then(({ equal, created }) => {
107+
expect(equal).toBe(true);
107108
if (!equal) {
108109
throw new Error(`Image mismatch for "${snapshotName}". See diff at: ${diffPath}`);
109110
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('path');
44
const looksSame = require('looks-same');
55

66
function ensureDirSync(dir) {
7-
if (!fs.existsSync(dir)) {
7+
if(!fs.existsSync(dir)) {
88
fs.mkdirSync(dir, { recursive: true });
99
}
1010
}
@@ -14,19 +14,19 @@ async function compareImages({ imageBuffer, snapshotPath, diffPath, threshold =
1414
ensureDirSync(path.dirname(diffPath));
1515

1616
// If no snapshot exists, create it
17-
if (!fs.existsSync(snapshotPath)) {
17+
if(!fs.existsSync(snapshotPath)) {
1818
fs.writeFileSync(snapshotPath, imageBuffer);
1919
return { equal: true, created: true };
2020
}
2121

2222
return new Promise((resolve, reject) => {
2323
looksSame(imageBuffer, fs.readFileSync(snapshotPath), {
24-
strict: false,
24+
strict: true,
2525
tolerance: threshold,
2626
}, (err, { equal }) => {
27-
if (err) return reject(err);
27+
if(err) return reject(err);
2828

29-
if (!equal) {
29+
if(!equal) {
3030
looksSame.createDiff({
3131
reference: snapshotPath,
3232
current: imageBuffer,

0 commit comments

Comments
 (0)