diff --git a/package.json b/package.json index c091e9f7..bc4276f1 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "install": "(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)", "clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*", "test": "semistandard && cpplint && npm run test-unit && npm run test-licensing", - "test-unit": "nyc --reporter=lcov --branches=99 mocha --parallel --slow=1000 --timeout=60000 ./test/unit/*.js", + "test-unit": "nyc --reporter=lcov --branches=99 mocha --slow=1000 --timeout=60000 ./test/unit/*.js", "test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"", "test-coverage": "./test/coverage/report.sh", "test-leak": "./test/leak/leak.sh", diff --git a/test/unit/svg.js b/test/unit/svg.js index 300e5c2b..fd436e27 100644 --- a/test/unit/svg.js +++ b/test/unit/svg.js @@ -1,5 +1,6 @@ 'use strict'; +const fs = require('fs'); const assert = require('assert'); const sharp = require('../../'); @@ -99,4 +100,18 @@ describe('SVG input', function () { fixtures.assertSimilar(fixtures.expected('svg-embedded.png'), data, done); }); }); + + it('Converts SVG with truncated embedded PNG', async () => { + const truncatedPng = fs.readFileSync(fixtures.inputPngTruncated).toString('base64'); + const svg = ` + + + `; + + const { info } = await sharp(Buffer.from(svg)).toBuffer({ resolveWithObject: true }); + assert.strictEqual(info.format, 'png'); + assert.strictEqual(info.width, 294); + assert.strictEqual(info.height, 240); + assert.strictEqual(info.channels, 4); + }); });