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

Non-eject customization #45

Closed
shilman opened this issue Feb 8, 2022 · 1 comment
Closed

Non-eject customization #45

shilman opened this issue Feb 8, 2022 · 1 comment
Labels
feature request New feature or request linear

Comments

@shilman
Copy link
Member

shilman commented Feb 8, 2022

Currently, to set up API hooks, you need to create a custom jest config.

Here's a strawman API for adding the API hooks that doesn't require ejecting:

// .storybook/test-runner.js
module.exports = {
  hooks: {
    preRender: (page, context) => { ... },
    postRender: (page, context) => { ... }
  },
}

Notes:

  • This allows us to change the test runner more easily in the future
  • This uses the .storybook directory, and maybe we should consider that for the jest config also
// jest-config.js
try {
  const { hooks } = require('.storybook/test-runner');
  ..
} catch(err) {}
@shilman shilman added feature request New feature or request linear labels Feb 8, 2022
@shilman
Copy link
Member Author

shilman commented Mar 2, 2022

implemented a slightly different design in #53

@shilman shilman closed this as completed Mar 2, 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 linear
Projects
None yet
Development

No branches or pull requests

1 participant