Skip to content

Commit bdb1986

Browse files
committedMar 17, 2021
Tests: run in parallel again
1 parent 55356c7 commit bdb1986

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"install": "(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)",
8181
"clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*",
8282
"test": "semistandard && cpplint && npm run test-unit && npm run test-licensing",
83-
"test-unit": "nyc --reporter=lcov --branches=99 mocha --slow=1000 --timeout=60000 ./test/unit/*.js",
83+
"test-unit": "nyc --reporter=lcov --branches=99 mocha --parallel --slow=1000 --timeout=60000 ./test/unit/*.js",
8484
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
8585
"test-coverage": "./test/coverage/report.sh",
8686
"test-leak": "./test/leak/leak.sh",

‎test/unit/toFormat.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ const sharp = require('../../');
55
const fixtures = require('../fixtures');
66

77
describe('toFormat', () => {
8-
it('accepts upper case characters as format parameter (string)', function (done) {
9-
sharp(fixtures.inputJpg)
8+
it('accepts upper case characters as format parameter (string)', async () => {
9+
const data = await sharp(fixtures.inputJpg)
10+
.resize(8, 8)
1011
.toFormat('PNG')
11-
.toBuffer(function (err, data, info) {
12-
if (err) throw err;
13-
assert.strictEqual('png', info.format);
14-
done();
15-
});
12+
.toBuffer();
13+
14+
const { format } = await sharp(data).metadata();
15+
assert.strictEqual(format, 'png');
1616
});
17-
it('accepts upper case characters as format parameter (object)', function (done) {
18-
sharp(fixtures.inputJpg)
17+
18+
it('accepts upper case characters as format parameter (object)', async () => {
19+
const data = await sharp(fixtures.inputJpg)
20+
.resize(8, 8)
1921
.toFormat({ id: 'PNG' })
20-
.toBuffer(function (err, data, info) {
21-
if (err) throw err;
22-
assert.strictEqual('png', info.format);
23-
done();
24-
});
22+
.toBuffer();
23+
24+
const { format } = await sharp(data).metadata();
25+
assert.strictEqual(format, 'png');
2526
});
2627
});

0 commit comments

Comments
 (0)
Please sign in to comment.