Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.js #16

Open
wants to merge 1 commit into
base: feature/pipeline
Choose a base branch
from

Conversation

anish-george88
Copy link

This is to fix the null exception in Azure pipeline while exporting html result file.
##[warning]TypeError: Cannot read property '1' of null checkIfSuccessful

This is to fix the null exception in Azure pipeline while exporting html result file.
##[warning]TypeError: Cannot read property '1' of null checkIfSuccessful
@ekav555
Copy link

ekav555 commented May 24, 2023

@anish-george88 This fixed the error, but caused another.

##[warning]TypeError: Assignment to constant variable.
at checkIfSuccessful (/home/ekavanaghadm/myagent/_work/_tasks/UploadPostmanHtmlReport_f5384bf0-1b5c-11ea-b0cc-5b064956a213/1.1.3/index.js:65:12)
at files.forEach.file (/home/ekavanaghadm/myagent/_work/_tasks/UploadPostmanHtmlReport_f5384bf0-1b5c-11ea-b0cc-5b064956a213/1.1.3/index.js:34:20)
at Array.forEach ()
at run (/home/ekavanaghadm/myagent/_work/_tasks/UploadPostmanHtmlReport_f5384bf0-1b5c-11ea-b0cc-5b064956a213/1.1.3/index.js:18:9)
at Object. (/home/ekavanaghadm/myagent/_work/_tasks/UploadPostmanHtmlReport_f5384bf0-1b5c-11ea-b0cc-5b064956a213/1.1.3/index.js:97:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
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)

@ekav555
Copy link

ekav555 commented May 24, 2023

@anish-george88` this fixed it for me.

function checkIfSuccessful (document) {
const text = document("div.card-header").find("a:contains('Failed Tests')").text()
var result = 0
if(text != null){
if(text.match(template) != null){
result = new Number(text.match(template)[1])
}
}
return result > 0 ? false : true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants