Skip to content

Commit

Permalink
Tests: remove possible race condition
Browse files Browse the repository at this point in the history
Simplify JP2 quality size check
  • Loading branch information
lovell committed Mar 9, 2022
1 parent 9280742 commit fcbe4e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ freebsd_instance:
image_family: freebsd-14-0-snap

task:
name: FreeBSD 13.0
name: FreeBSD
env:
IGNORE_OSVERSION: yes
skip_notifications: true
Expand Down
11 changes: 2 additions & 9 deletions test/unit/jp2.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,8 @@ describe('JP2 output', () => {
.resize(320, 240)
.toBuffer(function (err, buffer80) {
if (err) throw err;
sharp(fixtures.inputJp2)
.resize(320, 240)
.jp2({ quality: 90 })
.toBuffer(function (err, buffer90) {
if (err) throw err;
assert(buffer70.length < buffer80.length);
assert(buffer80.length < buffer90.length);
done();
});
assert(buffer70.length < buffer80.length);
done();
});
});
});
Expand Down
11 changes: 7 additions & 4 deletions test/unit/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ describe('Utilities', function () {
});

describe('Counters', function () {
it('Have zero value at rest', function () {
const counters = sharp.counters();
assert.strictEqual(0, counters.queue);
assert.strictEqual(0, counters.process);
it('Have zero value at rest', (done) => {
queueMicrotask(() => {
const counters = sharp.counters();
assert.strictEqual(0, counters.queue);
assert.strictEqual(0, counters.process);
done();
});
});
});

Expand Down

0 comments on commit fcbe4e1

Please sign in to comment.