mclay / azure-pipeline-allure-report

Other
5 stars 4 forks source link

[error]Unhandled: Unexpected token ? #17

Open etuviana opened 8 months ago

etuviana commented 8 months ago

Hi Guys after i add Allure plugin to Azure DevOps i added to automation.yml

task: PublishAllureReport@1 inputs: reportDir: 'allure-results'

but i get Error

Help : Replace with markdown to show in help

[debug]Using node path: C:\agent\automation01\externals\node10\bin\node.exe

[debug]agent.TempDirectory=C:\agent\automation01_work_temp

[debug]loading inputs and endpoints

[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN

[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION

[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION

[debug]loading INPUT_REPORTDIR

[debug]loading INPUT_TABNAME

[debug]loading SECRET_SYSTEM_ACCESSTOKEN

[debug]loaded 6

[debug]Agent.ProxyUrl=undefined

[debug]Agent.CAInfo=undefined

[debug]Agent.ClientCert=undefined

[debug]Agent.SkipCertValidation=undefined

[debug]task result: Failed

[error]Unhandled: Unexpected token ?

[debug]Processed: ##vso[task.issue type=error;]Unhandled: Unexpected token ?

[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Unexpected token ?

[error]C:\agent\automation01_work_tasks\PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973\1.0.21\node_modules\jsdom\lib\api.js:139

      referrer: req.getHeader("referer") ?? undefined
                                          ^

SyntaxError: Unexpected token ? at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (C:\agent\automation01_work_tasks\PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973\1.0.21\dist\index.js:15:17) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

[debug]Processed: ##vso[task.issue type=error;]C:\agent\automation01_work_tasks\PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973\1.0.21\node_modules\jsdom\lib\api.js:139%0A referrer: req.getHeader("referer") ?? undefined%0A ^%0A%0ASyntaxError: Unexpected token ?%0A at Module._compile (internal/modules/cjs/loader.js:723:23)%0A at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)%0A at Module.load (internal/modules/cjs/loader.js:653:32)%0A at tryModuleLoad (internal/modules/cjs/loader.js:593:12)%0A at Function.Module._load (internal/modules/cjs/loader.js:585:3)%0A at Module.require (internal/modules/cjs/loader.js:692:17)%0A at require (internal/modules/cjs/helpers.js:25:18)%0A at Object. (C:\agent\automation01_work_tasks\PublishAllureReport_bf52d8fd-c399-4acd-98c7-a03ceee2a973\1.0.21\dist\index.js:15:17)%0A at Module._compile (internal/modules/cjs/loader.js:778:30)%0A at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Finishing: PublishAllureReport

allure allure2

please Help, Thanks :)

Elad

JJorgemartin commented 8 months ago

I have the same problem, I use Azure DevOps agents on premise on a windows server. How could I solve to be able to visualize the report in ADO.

etuviana commented 8 months ago

Thanks @JJorgemartin
but now its work for u ? if Yes , So please let me know more details how do I do it ? commands ? Settings ? Screenshot Thanks

JJorgemartin commented 8 months ago

image image I still have the same problem. Try changing the package.json These are the screenshots of how the error occurs and how the pipeline task is configured.

zhusulai commented 5 months ago

My team tried this extension and ran into the same error. It seems to be caused by this issue: https://stackoverflow.com/questions/58144825/uncaught-syntaxerror-unexpected-token. Not sure if there is a workaround.

etuviana commented 5 months ago

@zhusulai @JJorgemartin @mclay I found the solution , you must node js installed on your PC , or try to running on Windows server 2022 its include there Another thing you must add generate to Pipeline before you publish script: 'allure generate $(Pipeline.Workspace)\YourFolder\allure-results -c -o $(Pipeline.Workspace)\YourFolder\allure-report' condition: always() displayName: 'generate allure'

Elad