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

Stdout/stderr from tests aren't properly wrapped I think #68

Open
vlovich opened this issue Jan 24, 2023 · 1 comment
Open

Stdout/stderr from tests aren't properly wrapped I think #68

vlovich opened this issue Jan 24, 2023 · 1 comment

Comments

@vlovich
Copy link

vlovich commented Jan 24, 2023

The problem

My experience with Jest & Jest-teamcity has been that console.X messages are written wrapped with the relevant TeamCity adoration to assign the output to the running test it was for. However, this reporter seems to treat console.X messages as passthrough. Another niggle is that when using Miniflare 3, you can get output to stdio directly from workerd. So it would be nice if stdout and stderr were redirected into the reporter on launch and adorned with the appropriate TeamCity wrapper text to assign it to the specific test generating that output..

Environment

  • What mocha-teamcity-reporter version are you using
  • 4.2
  • Version of NPM/yarn etc and Node.js
  • npm 9.2, node 18.13
  • Version of teamcity (If Applicable)
  • 2021.2.3 build 99711

Details

An example test or code sample

example.test.js:

test('abc', async () => {
   console.error('waiting')
   await new Promise((resolve) => setTimeout(resolve, 100))
   process.stdout.write('finished wait\n')
})

I would expect waiting and finished wait to be printed adorned with TeamCity service messages assigning that output to test abc.

As I understand it, TeamCity only allows a single testStdOut / testStdErr per test so it sounds like you have to buffer stdout / stderr to memory/disk and then output it BEFORE writing out testFinished / testFailed. That being said, I have my own custom wrapper that I wrote using teamcity-service-message for non-mocha things and generating multiple testStdout / testStderr lines repeatedly seems to maybe work (although maybe I'm just not noticing the failure mode).

@SimonFischer04
Copy link

experiencing same issue here, @vlovich have you found a solution yet?

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

No branches or pull requests

2 participants