1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-AntV-F2

Клонировать/Скачать
jest-setup.js 724 Байты
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
zengyue ye Отправлено 24.01.2022 05:12 9d35df7
// eslint-disable-next-line
const { configureToMatchImageSnapshot } = require('jest-image-snapshot');
// eslint-disable-next-line
const CanvasConverter = require('canvas-to-buffer');
const toMatchImageSnapshot = configureToMatchImageSnapshot({
failureThreshold: 0.001,
failureThresholdType: 'percent',
});
expect.extend({
toMatchImageSnapshot(received) {
const converter = new CanvasConverter(received.canvas, {
image: { types: ['png'] },
});
const execPath = process.execPath;
// toMatchImageSnapshot 需要使用 node 环境
process.execPath = 'node';
const result = toMatchImageSnapshot.call(this, converter.toBuffer());
process.execPath = execPath;
return result;
},
});

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-AntV-F2.git
git@api.gitlife.ru:oschina-mirror/mirrors-AntV-F2.git
oschina-mirror
mirrors-AntV-F2
mirrors-AntV-F2
master