diff --git a/src/generators/asset-types/__tests__/ttf.ts b/src/generators/asset-types/__tests__/ttf.ts index 291e7f98..f756d171 100644 --- a/src/generators/asset-types/__tests__/ttf.ts +++ b/src/generators/asset-types/__tests__/ttf.ts @@ -25,15 +25,18 @@ describe('`TTF` font generator', () => { const result = await ttfGen.generate(mockOptions(), svg); expect(svg2ttf).toHaveBeenCalledTimes(1); - expect(svg2ttf).toHaveBeenCalledWith(svg, { __mock: 'options__' }); + expect(svg2ttf).toHaveBeenCalledWith(svg, { + ts: 0, + __mock: 'options__' + }); expect(result).toEqual(Buffer.from(`::ttf(${svg})::`)); }); - test('passes correctly format options to `svg2ttf`', async () => { + test('passes correctly format options to `svg2ttf` and sets `ts` (timestamp) to `0` by default to avoid generating unnecessary diffs', async () => { const formatOptions = { foo: 'bar' }; await ttfGen.generate(mockOptions(formatOptions), svg); expect(svg2ttf).toHaveBeenCalledTimes(1); - expect(svg2ttf.mock.calls[0][1]).toEqual(formatOptions); + expect(svg2ttf.mock.calls[0][1]).toEqual({ ts: 0, ...formatOptions }); }); }); diff --git a/src/generators/asset-types/ttf.ts b/src/generators/asset-types/ttf.ts index 4e7a23db..69662f09 100644 --- a/src/generators/asset-types/ttf.ts +++ b/src/generators/asset-types/ttf.ts @@ -6,7 +6,7 @@ const generator: FontGenerator = { dependsOn: FontAssetType.SVG, async generate({ formatOptions }, svg) { - const font = svg2ttf(svg, formatOptions?.ttf); + const font = svg2ttf(svg, { ts: 0, ...(formatOptions?.ttf || {}) }); return Buffer.from(font.buffer); } };