@@ -5,6 +5,8 @@ const { PNG } = require("pngjs");
55const sharp = require ( "sharp" ) ;
66const pdfParse = require ( "pdf-parse" ) ;
77
8+ const pdfParseFn = typeof pdfParse === "function" ? pdfParse : pdfParse . default ;
9+
810module . exports = defineConfig ( {
911 e2e : {
1012 baseUrl : "http://localhost" ,
@@ -20,7 +22,6 @@ module.exports = defineConfig({
2022 setupNodeEvents ( on , config ) {
2123 on ( "task" , {
2224 async verifyPdf ( { filePath, options = { } } ) {
23- // DOMMatrix tanımı Node için
2425 if ( typeof global . DOMMatrix === "undefined" ) {
2526 global . DOMMatrix = class DOMMatrix { } ;
2627 }
@@ -35,11 +36,11 @@ module.exports = defineConfig({
3536 // Text extraction Node-only
3637 if ( options . checkText ) {
3738 const dataBuffer = fs . readFileSync ( filePath ) ;
38- const pdfData = await pdfParse ( dataBuffer ) ;
39+ const pdfData = await pdfParseFn ( dataBuffer ) ;
3940 extractedText = pdfData . text ;
4041 }
4142
42- // Pixelmatch lazy import
43+ // Pixelmatch import
4344 let pixelmatch ;
4445 if ( options . referenceLogoPath ) {
4546 const pm = await import ( "pixelmatch" ) ;
@@ -64,7 +65,9 @@ module.exports = defineConfig({
6465 if ( options . referenceLogoPath && args [ 0 ] ) {
6566 const objName = args [ 0 ] ;
6667 const imgData = await page . objs . get ( objName ) ;
67- if ( ! imgData ) continue ;
68+ if ( ! imgData ) {
69+ continue ;
70+ }
6871
6972 const pdfImg = new PNG ( { width : imgData . width , height : imgData . height } ) ;
7073 pdfImg . data = imgData . data ;
@@ -136,4 +139,4 @@ module.exports = defineConfig({
136139 } ) ;
137140 } ,
138141 } ,
139- } ) ;
142+ } ) ;
0 commit comments