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

testResultsProcessor as async function? #11683

Closed
mariusbob opened this issue Jul 21, 2021 · 4 comments · Fixed by #13343
Closed

testResultsProcessor as async function? #11683

mariusbob opened this issue Jul 21, 2021 · 4 comments · Fixed by #13343

Comments

@mariusbob
Copy link

mariusbob commented Jul 21, 2021

I am trying to use testResultsProcessor and exported a function as

module.exports = async function(data) {

//get data I need from here

//call TestRail API and update the test run
await callTestRailAPI();

return data;
}

On my local machine, it works fine, the results are uploaded to Testrail.
The weird stuff happens when I run a job in CircleCI: the tests are green, the results are uploaded to TestRail, BUT the job is fails with the following error:

Exited with code exit status 1
CircleCI received exit code 1

I have figured out that this due to the async function exported.
Also tried this way:

module.exports = function(data) {
(async function() {
await callTestRailAPI();
})()

return data;
}

....but the async block is not called.

Does anyone have any clue on this?

@shwarcu
Copy link

shwarcu commented Jul 15, 2022

I am facing similar issue. I run asynchronous function in my results processor, no matter how I handle outcome of it, process always returns code 1 instead of 0.

async function processResults(results) {

  await asyncFunctionThatReturnsVoid(results);

  return results;
}

module.exports = processResults;

@SimenB
Copy link
Member

SimenB commented Jul 15, 2022

We don't support it being async today. Trivial change tho, PR welcome!

https://github.com/facebook/jest/blob/9f4dc3e9e69cc7dd0f024c5d364bd68c3cb65080/packages/jest-core/src/runJest.ts#L102

@SimenB
Copy link
Member

SimenB commented Oct 14, 2022

https://github.com/facebook/jest/releases/tag/v29.2.0

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants