We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi all, I am using allure-Jest, does anyone know how I can add the response and request to the reporter? jest-allure": "^0.1.1"
The text was updated successfully, but these errors were encountered:
for latest versions, which supports Html in description. something like this
await nodeFetch(url, init) .then(async (result) => { const { headers, status, statusText, ok, redirected, url } = result; let data; const contentDisposition = headers.get("content-disposition"); if (contentDisposition) { const match = contentDisposition.match( /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/ ); const filename = (match ? match[1] : "").replace(/"|'/g, ""); const buffer = await result.buffer(); reporter.attachment(filename, buffer, {fileExtension: filename.split(".")[1]} as unknown as ContentType); data = buffer; } else { const responseText = await result.text(); try { data = JSON.parse(responseText); } catch (error) { data = responseText; } } const allureResponse = { headers, status, statusText, ok, redirected, data, url, }; reporter.addDescription(getRequestDescription(allureResponse, init)); return allureResponse; }) .catch((error) => { reporter.addDescription(getRequestErrorDescription(url, init)); throw error; });
where getRequestDescription returns html strings for example:
<p> <div>${init?.method || "GET"}: ${url}</div> </p> <p> <div>Headers: </div> <div><i><pre>${JSON.stringify(init?.headers, null, 4)}</pre></i></div>
<p> <div>Body</div> <div><i>${init?.body}</i></div> </p> <strong> <div>Response</div></strong> <hr> <p> <div>Status: ${status} ${statusText}</div> </p> <p> <div>Headers: </div> <div> <i><pre>${JSON.stringify( R.fromPairs(Array.from(headers.entries())), null, 4 )} </pre></i> </div> </p> <p> <div>Body</div> <div><i><pre>${responseText}</pre></i></div> </p>
Sorry, something went wrong.
No branches or pull requests
Hi all, I am using allure-Jest, does anyone know how I can add the response and request to the reporter?
jest-allure": "^0.1.1"
The text was updated successfully, but these errors were encountered: