Skip to content

Commit

Permalink
Use features instead of version for build verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peeterush committed Nov 7, 2023
1 parent 2160b79 commit 3088496
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/dist/test-CJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ const { initializeImageMagick, Magick } = require('../../dist/index.umd.js');
const wasmLocation = '../../node_modules/@dlemstra/magick-native/magick.wasm';

initializeImageMagick(wasmLocation).then(() => {
console.log(Magick.imageMagickVersion);
console.log(Magick.features);
});
2 changes: 1 addition & 1 deletion tests/dist/test-ESM.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import { initializeImageMagick, Magick } from '../../dist/index.mjs';
const wasmLocation = '../../node_modules/@dlemstra/magick-native/magick.wasm';

initializeImageMagick(wasmLocation).then(() => {
console.log(Magick.imageMagickVersion);
console.log(Magick.features);
});
9 changes: 3 additions & 6 deletions tests/dist/test-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const colorReset = '\x1b[0m';
const colorGreen = '\x1b[32m';
const colorRed = '\x1b[31m';

const versionRegEx =
/^ImageMagick \d+\.\d+\.\d+-\d+ Q8 x86_64 [\w\d]+:[\w\d]+ https:\/\/imagemagick\.org$/;
const features = 'Cipher';

let foundError = false;

Expand All @@ -29,17 +28,15 @@ async function testDistFile(filename) {

const name = filename.substring(5, 8);

if (stdout.trim().match(versionRegEx)) {
if (stdout.trim() === features) {
console.log(`${colorGreen}${name} build passed${colorReset}`);
return;
}

foundError = true;

console.error(`${colorRed}${name} build failed:${colorReset}`);
console.error(
stderr || `"${stdout.trim()}"\ndoes not match\n${versionRegEx}`
);
console.error(stderr || `"${stdout.trim()}"\ndoes not match\n"${features}"`);
}

async function testDist() {
Expand Down

0 comments on commit 3088496

Please sign in to comment.