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

add --testTimeout cli option from jest #409

Merged
merged 2 commits into from
May 9, 2024

Conversation

skratchdot
Copy link
Contributor

Thanks for the work on this great library!

We are using it and are experiencing errors like:

thrown: "Exceeded timeout of 15000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

We've tried the --maxWorkers suggestion from the docs. Instead of ejecting and updating the testTimeout, we would prefer to pass it via our jenkins script (which runs on the CI where our tests are timing out- they work fine locally without the timeout).

Before this PR, running test-storybook --testTimeout 20000 results in:

error: unknown option '--testTimeout'

Afterwards, it will work.

To test this PR, I ran yarn build, and then tested a few commands:

set test timeout to 20ms (it should fail):

./dist/test-storybook.js --testTimeout=20
image

set test timeout to 20s (it should pass):

./dist/test-storybook.js --testTimeout=20_000
image

@skratchdot
Copy link
Contributor Author

skratchdot commented Nov 30, 2023

I was just reading through some of the issues logged in this repo, and found:
#328

So I think this PR isn't strictly needed.

While this command errors:

test-storybook --testTimeout 20000

I think this works:

test-storybook -- --testTimeout 20000

So feel free to close this PR. But I'm also fine with it still being merged (so both of the commands above work).

@bryanjtc
Copy link
Member

bryanjtc commented Dec 1, 2023

@skratchdot What version of the test runner are you using? 0.16.0 should allow any jest option without the additional -- .

@skratchdot
Copy link
Contributor Author

skratchdot commented Dec 1, 2023

@skratchdot What version of the test runner are you using? 0.16.0 should allow any jest option without the additional -- .

@bryanjtc - We are using v16

Again, this works:

test-storybook -- --testTimeout 20000

This errors:

test-storybook --testTimeout 20000

You should be able to test by checking out the next branch (or v0.16.0 tag) and running:

yarn build
./dist/test-storybook.js --testTimeout 20000

which will show:

error: unknown option '--testTimeout'

and:

If you'd like this option to be supported, please open an issue at https://github.com/storybookjs/test-runner/issues/new

@Jero786
Copy link

Jero786 commented Feb 20, 2024

test-storybook -- --testTimeout 20000

That works for me, thank you @skratchdot

@yannbf
Copy link
Member

yannbf commented May 9, 2024

Thanks a lot for your contribution @skratchdot !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants