Included in these configurations:
- addon-interactions
- recommended
Storybook provides a browser compatible version of Jest's expect via the @storybook/jest library.
When writing interactions and asserting values, you should always use expect
from the @storybook/jest
library.
Examples of incorrect code for this rule:
Default.play = () => {
// using global expect from Jest. Will break on the browser
expect(123).toEqual(123)
}
Examples of correct code for this rule:
import { expect } from '@storybook/jest'
Default.play = () => {
// using imported expect from storybook package
expect(123).toEqual(123)
}
This rule should not be applied in test files. Please ensure you are defining the storybook rules only for story files. You can see more details here.
If there are other links that describe the issue this rule addresses, please include them here in a bulleted list.