ค้นหาเว็บไซต์

typescript - ปลั๊กอิน allure-cypress เวอร์ชัน 3.0.7+ ทำให้เกิด Unexpected token ขณะกำลังวิเคราะห์ allure-cypress\dist\cjs\index.js


ฉันอัปเกรดเป็นเวอร์ชัน 3.0.7 และทดสอบเวอร์ชันใหม่ของปลั๊กอิน allure-cypress ด้วย เมื่อฉันรันสคริปต์ทดสอบของฉัน ฉันได้รับข้อผิดพลาดดังต่อไปนี้:

Oops...we found an error preparing this test file:    > cypress\support\e2e.ts  The error was:  SyntaxError: Unexpected token (1:16307) while parsing C:\Users\USER\allure-cypress\dist\cjs\index.js while parsing file: C:\Users\USER\node_modules\allure-cypress\dist\cjs\index.js     at DestroyableTransform.end [as _flush]
(C:\Users\USER\node_modules\insert-module-globals\index.js:114:21)
    at DestroyableTransform.prefinish (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:138:10)
    at DestroyableTransform.emit (node:events:513:28)
    at DestroyableTransform.emit (node:domain:489:12)
    at prefinish (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:619:14)
    at finishMaybe (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:627:5)
    at endWritable (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:638:3)
    at DestroyableTransform.Writable.end (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:594:22)
    at DestroyableTransform.onend (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:627:28)
    at DestroyableTransform.emit (node:events:525:35)
    at DestroyableTransform.emit (node:domain:489:12)
    at endReadableNT (C:\Users\USER\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:1010:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)"  

เวอร์ชัน 3.0.5 และต่ำกว่าสามารถใช้งานได้ดี ฉันกำลังใช้เฟรมเวิร์ก Cypress และ Cucumber และมีการแก้ไขปัญหาบางอย่างในเวอร์ชันใหม่กว่าที่ฉันต้องการเพื่อให้รายงานรวมขั้นตอนการทดสอบที่ถูกต้องภายใต้ Test body ในไฟล์ e2e.ts ของฉัน ฉันกำลังนำเข้าปลั๊กอิน:

import "allure-cypress"

ฉันพยายามเพิ่มเส้นทางไปยังปลั๊กอิน allure-cypress และยังพยายามอนุญาตไฟล์ .js ภายใน 'include' ในไฟล์ tsconfig.json:

"include": [
"/*.ts",
"/*.js",
"./node_modules/cypress",
"./node_modules/allure-cypress/dist/cjs",
"./node_modules/allure-cypress"]

ฉันยังได้อัปเกรด/เปลี่ยนเวอร์ชันของปลั๊กอินต่อไปนี้ภายในไฟล์ package.json เพื่อตรวจสอบว่ามีปัญหาเกี่ยวกับความเข้ากันได้หรือไม่:

"cucumber": "latest" 
"@types/node": "latest" 
"allure-cypress": "^3.0.9" 
"typescript": "^5.4.5" 
"cypress": "^13.17.0"
"@badeball/cypress-cucumber-preprocessor": "^20.0.6"