renanvaz/trim-image

Bug report: Unexpected quit when no options are sent

Opened this issue · 0 comments

Node program unexpectedly quits when executing the package when no options are sent.

Test

Given a list of files x.png, y.png, and z.png in a srcPath:

const path = require('path');
const { promisify } = require('util');

const cropImage = promisify(trimImage);

const srcPath = '...';
const outPath = '...';
const imageNames = ['x.png', 'y.png', 'z.png'];

for (const imageName of imageNames) {
  const srcImagePath = path.join(srcPath, imageName);
  const outImagePath = path.join(outPath, imageName);
  await cropImage(srcImagePath, outImagePath); // No options are sent
}

Received

Only the first image is trimmed. Then the program quits without an error.

Expected

All images are trimmed.

Workaround

The options have to be sent to be executed, like:

...
await cropImage(srcImagePath, outImagePath, {
 left: true,
  right: true,
  top: true,
  bottom: true
});
...

Environment

  • os -v: mac mojave
  • node -v: 12.4.0
  • npm -v: 6.13.4