mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Tests: require 100% branch coverage to pass
Remove old coverage tooling, coveralls
This commit is contained in:
parent
b0c69f1ee9
commit
2d49f0e93e
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -7,7 +7,6 @@ jobs:
|
|||||||
CI:
|
CI:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for npx prebuild to make release
|
contents: write # for npx prebuild to make release
|
||||||
checks: write # to create new checks (coverallsapp/github-action)
|
|
||||||
name: ${{ matrix.container || matrix.os }} - Node.js ${{ matrix.nodejs_version }} ${{ matrix.nodejs_arch }} ${{ matrix.prebuild && '- prebuild' }}
|
name: ${{ matrix.container || matrix.os }} - Node.js ${{ matrix.nodejs_version }} ${{ matrix.nodejs_arch }} ${{ matrix.prebuild && '- prebuild' }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
@ -18,7 +17,6 @@ jobs:
|
|||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
container: centos:7
|
container: centos:7
|
||||||
nodejs_version: 14
|
nodejs_version: 14
|
||||||
coverage: true
|
|
||||||
prebuild: true
|
prebuild: true
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
container: centos:7
|
container: centos:7
|
||||||
@ -95,11 +93,6 @@ jobs:
|
|||||||
run: npm install --build-from-source --unsafe-perm
|
run: npm install --build-from-source --unsafe-perm
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm test
|
run: npm test
|
||||||
- name: Coverage
|
|
||||||
if: matrix.coverage
|
|
||||||
uses: coverallsapp/github-action@1.1.3
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Prebuild
|
- name: Prebuild
|
||||||
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
|
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/')
|
||||||
env:
|
env:
|
||||||
|
@ -98,7 +98,6 @@ readableStream
|
|||||||
A [guide for contributors](https://github.com/lovell/sharp/blob/main/.github/CONTRIBUTING.md)
|
A [guide for contributors](https://github.com/lovell/sharp/blob/main/.github/CONTRIBUTING.md)
|
||||||
covers reporting bugs, requesting features and submitting code changes.
|
covers reporting bugs, requesting features and submitting code changes.
|
||||||
|
|
||||||
[](https://coveralls.io/r/lovell/sharp?branch=main)
|
|
||||||
[](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix)
|
[](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix)
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
@ -511,15 +511,12 @@ function trim (trim) {
|
|||||||
}
|
}
|
||||||
} else if (is.object(trim)) {
|
} else if (is.object(trim)) {
|
||||||
this._setBackgroundColourOption('trimBackground', trim.background);
|
this._setBackgroundColourOption('trimBackground', trim.background);
|
||||||
|
|
||||||
if (!is.defined(trim.threshold)) {
|
if (!is.defined(trim.threshold)) {
|
||||||
this.options.trimThreshold = 10;
|
this.options.trimThreshold = 10;
|
||||||
} else if (is.number(trim.threshold)) {
|
} else if (is.number(trim.threshold) && trim.threshold >= 0) {
|
||||||
if (trim.threshold >= 0) {
|
this.options.trimThreshold = trim.threshold;
|
||||||
this.options.trimThreshold = trim.threshold;
|
} else {
|
||||||
} else {
|
throw is.invalidParameterError('threshold', 'positive number', trim);
|
||||||
throw is.invalidParameterError('threshold', 'positive number', trim);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw is.invalidParameterError('trim', 'string, number or object', trim);
|
throw is.invalidParameterError('trim', 'string, number or object', trim);
|
||||||
|
@ -92,9 +92,8 @@
|
|||||||
"clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*",
|
"clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*",
|
||||||
"test": "npm run test-lint && npm run test-unit && npm run test-licensing",
|
"test": "npm run test-lint && npm run test-unit && npm run test-licensing",
|
||||||
"test-lint": "semistandard && cpplint",
|
"test-lint": "semistandard && cpplint",
|
||||||
"test-unit": "nyc --reporter=lcov --branches=99 mocha --slow=1000 --timeout=60000 ./test/unit/*.js",
|
"test-unit": "nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha --slow=1000 --timeout=10000 ./test/unit/*.js",
|
||||||
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
||||||
"test-coverage": "./test/coverage/report.sh",
|
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
"docs-build": "documentation lint lib && node docs/build && node docs/search-index/build",
|
"docs-build": "documentation lint lib && node docs/build && node docs/search-index/build",
|
||||||
"docs-serve": "cd docs && npx serve",
|
"docs-serve": "cd docs && npx serve",
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
CPPFLAGS="--coverage" LDFLAGS="--coverage" npm rebuild
|
|
||||||
npm test
|
|
||||||
geninfo --no-external --base-directory src --output-file coverage/sharp.info build/Release/obj.target/sharp/src
|
|
||||||
genhtml --title sharp --demangle-cpp --output-directory coverage/sharp coverage/*.info
|
|
@ -175,12 +175,13 @@ describe('Text to image', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('fontfile input', function () {
|
it('fontfile input', function () {
|
||||||
// Added for code coverage
|
assert.doesNotThrow(function () {
|
||||||
sharp({
|
sharp({
|
||||||
text: {
|
text: {
|
||||||
text: 'text',
|
text: 'text',
|
||||||
fontfile: 'UnknownFont.ttf'
|
fontfile: 'UnknownFont.ttf'
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user