test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

[Bug] Jest --findRelatedTests is not supported

Open pmcelhaney opened this issue 2 years ago • 2 comments

Describe the bug

test-storybook supports most of the Jest CLI options, but --findRelatedTests is not one of them.

Steps to reproduce the behavior

yarn test-storybook --findRelatedTests src/my-changed-file.js

Expected behavior

Storybook passes the findRelatedTests option to Jest, and any tests/stories that depend on src/my-changed-file.js are run.

Actual behavior

error: unknown option '--findRelatedTests'

Environment

  • OS: OS X
  • Node.js version: v16.14.2
  • NPM version: 8.5.0

pmcelhaney avatar Nov 30 '22 17:11 pmcelhaney

I'm guessing it would need to be added to this file.

https://github.com/storybookjs/test-runner/blob/next/src/util/getParsedCliOptions.ts

pmcelhaney avatar Dec 02 '22 14:12 pmcelhaney

I had a similar problem but with --passWithNoTests. The following syntax helped me:

test-storybook --coverage -- --passWithNoTests

Pay attention to the -- part.

boar-is avatar Jan 11 '23 20:01 boar-is