Limit the amount of console "spam" during fuzz tests (PR 17337 follow-up)

Having just tested PR 17337 locally I noticed that especially the `JpxImage`-test causes a "ridiculous" amount of warning messages to be printed, which doesn't seem helpful.
Given that only actual `Error`s should be relevant here, we can easily disable this logging during the tests.
This commit is contained in:
Jonas Jenwald 2023-12-04 16:19:25 +01:00
parent 476cb84d92
commit d7bec1b527
5 changed files with 36 additions and 5 deletions

View File

@ -13,7 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { getVerbosityLevel, setVerbosityLevel } from "./shared/util.js"; import {
getVerbosityLevel,
setVerbosityLevel,
VerbosityLevel,
} from "./shared/util.js";
import { Jbig2Image } from "./core/jbig2.js"; import { Jbig2Image } from "./core/jbig2.js";
import { JpegImage } from "./core/jpg.js"; import { JpegImage } from "./core/jpg.js";
import { JpxImage } from "./core/jpx.js"; import { JpxImage } from "./core/jpx.js";
@ -31,4 +35,5 @@ export {
JpegImage, JpegImage,
JpxImage, JpxImage,
setVerbosityLevel, setVerbosityLevel,
VerbosityLevel,
}; };

View File

@ -1,4 +1,11 @@
import { Jbig2Image } from "../../build/image_decoders/pdf.image_decoders.mjs"; import {
Jbig2Image,
setVerbosityLevel,
VerbosityLevel,
} from "../../build/image_decoders/pdf.image_decoders.mjs";
// Avoid unnecessary console "spam", by ignoring `info`/`warn` calls.
setVerbosityLevel(VerbosityLevel.ERRORS);
const ignored = ["Cannot read properties", "JBIG2 error"]; const ignored = ["Cannot read properties", "JBIG2 error"];

View File

@ -1,4 +1,11 @@
import { JpegImage } from "../../build/image_decoders/pdf.image_decoders.mjs"; import {
JpegImage,
setVerbosityLevel,
VerbosityLevel,
} from "../../build/image_decoders/pdf.image_decoders.mjs";
// Avoid unnecessary console "spam", by ignoring `info`/`warn` calls.
setVerbosityLevel(VerbosityLevel.ERRORS);
const ignored = ["Cannot read properties", "JPEG error"]; const ignored = ["Cannot read properties", "JPEG error"];

View File

@ -1,4 +1,11 @@
import { JpxImage } from "../../build/image_decoders/pdf.image_decoders.mjs"; import {
JpxImage,
setVerbosityLevel,
VerbosityLevel,
} from "../../build/image_decoders/pdf.image_decoders.mjs";
// Avoid unnecessary console "spam", by ignoring `info`/`warn` calls.
setVerbosityLevel(VerbosityLevel.ERRORS);
const ignored = ["Cannot read properties", "JPX error"]; const ignored = ["Cannot read properties", "JPX error"];

View File

@ -13,7 +13,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { getVerbosityLevel, setVerbosityLevel } from "../../src/shared/util.js"; import {
getVerbosityLevel,
setVerbosityLevel,
VerbosityLevel,
} from "../../src/shared/util.js";
import { Jbig2Image } from "../../src/core/jbig2.js"; import { Jbig2Image } from "../../src/core/jbig2.js";
import { JpegImage } from "../../src/core/jpg.js"; import { JpegImage } from "../../src/core/jpg.js";
import { JpxImage } from "../../src/core/jpx.js"; import { JpxImage } from "../../src/core/jpx.js";
@ -35,6 +39,7 @@ describe("pdfimage_api", function () {
JpegImage, JpegImage,
JpxImage, JpxImage,
setVerbosityLevel, setVerbosityLevel,
VerbosityLevel,
}); });
}); });
}); });