Skip to content

Commit 4194504

Browse files
authored
test(index): cover spawn errors (#732)
* chore: remove instanbul ignore comments * chore: correct ignore type * test(index): cover spawn errors in `execBinary` * test(index): cover spawn errors in `pdfInfo` * chore: up test threshold * test(index): remove duplicate arrays
1 parent 4abae6a commit 4194504

File tree

3 files changed

+156
-52
lines changed

3 files changed

+156
-52
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@
7878
],
7979
"coverageThreshold": {
8080
"global": {
81-
"branches": 95,
81+
"branches": 96,
8282
"functions": 100,
83-
"lines": 98,
84-
"statements": 98
83+
"lines": 99,
84+
"statements": 99
8585
}
8686
},
8787
"injectGlobals": false,

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ function execBinary(binary, args, file, options = {}) {
538538
return;
539539
}
540540

541-
/* istanbul ignore else */
542541
if (stdOut !== "") {
543542
resolve(options.preserveWhitespace ? stdOut : stdOut.trim());
544543
} else if (code === 0) {
@@ -667,6 +666,7 @@ class Poppler {
667666
if (popplerPath) {
668667
this.#popplerPath = popplerPath;
669668
}
669+
670670
if (platform === "win32" && !popplerPath) {
671671
try {
672672
// @ts-ignore: Optional dependency
@@ -678,7 +678,6 @@ class Poppler {
678678
}
679679
}
680680

681-
/* istanbul ignore next: unable to test due to https://github.com/jestjs/jest/pull/14297 */
682681
if (!this.#popplerPath) {
683682
throw new Error(
684683
`Unable to find ${platform} Poppler binaries, please pass the installation directory as a parameter to the Poppler instance.`
@@ -1262,7 +1261,6 @@ class Poppler {
12621261
});
12631262

12641263
child.on("close", (code) => {
1265-
/* istanbul ignore else */
12661264
if (stdOut !== "") {
12671265
if (fileSize) {
12681266
stdOut = stdOut.replace(

0 commit comments

Comments
 (0)