Reduce chance of race condition in test for... race condition

This commit is contained in:
Lovell Fuller 2022-11-13 10:16:47 +00:00
parent df971207b8
commit a9d692fb43

View File

@ -443,13 +443,13 @@ describe('Image metadata', function () {
const create = { width: 1, height: 1, channels: 3, background: 'red' }; const create = { width: 1, height: 1, channels: 3, background: 'red' };
const image1 = sharp({ create }).png().pipe(sharp()); const image1 = sharp({ create }).png().pipe(sharp());
const image2 = sharp({ create }).png().pipe(sharp()); const image2 = sharp({ create }).png().pipe(sharp());
process.nextTick(async () => { setTimeout(async () => {
const data1 = await image1.metadata(); const data1 = await image1.metadata();
assert.strictEqual('png', data1.format); assert.strictEqual('png', data1.format);
const data2 = await image2.metadata(); const data2 = await image2.metadata();
assert.strictEqual('png', data2.format); assert.strictEqual('png', data2.format);
done(); done();
}); }, 500);
}); });
it('Stream', function (done) { it('Stream', function (done) {