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

[Feature] Send console output to terminal #155

Closed
IanVS opened this issue Aug 2, 2022 · 2 comments
Closed

[Feature] Send console output to terminal #155

IanVS opened this issue Aug 2, 2022 · 2 comments
Labels
feature request New feature or request

Comments

@IanVS
Copy link
Member

IanVS commented Aug 2, 2022

Describe the feature

I've hit a situation where tests are passing in the browser, but not in the test-runner. Without having some way to inspect the state of my story in the test-runner, it's very difficult to troubleshoot what is happening. I propose one of two things:

  1. Send all console output to the terminal in the case of failing tests. There could be useful information which can help debug the reason for the failure, so it should be provided to the user. Passing tests should not output console warnings or logs.

  2. Add a flag to send all console output to the terminal, for passing and failing tests. I think this is less desirable, because it's another flag that people have to learn.

@IanVS IanVS added bug Something isn't working feature request New feature or request and removed bug Something isn't working labels Aug 2, 2022
@IanVS
Copy link
Member Author

IanVS commented Aug 2, 2022

I tried poking around to find a way to make this happen, without luck so far. But as a workaround, I can add a .storybook/test-runner.cjs with the contents:

module.exports = {
  async preRender(page) {
    page.on('console', (err) => {
      throw new Error(err.text());
    });
  },
};

and I get console output, at least as a debugging tool.

@yannbf
Copy link
Member

yannbf commented Aug 17, 2022

Closed via #157 ! Currently available in 0.6.0-next.1 :D

@yannbf yannbf closed this as completed Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants