Documentation is conflicting?
Opened this issue · 1 comments
is it .storybook/__mocks__/facade.js
or .storybook/facade.js
or both?
import { storiesOf } from '@kadira/storybook' < --- this is the depreciated version? new version should be just @storybook
Should this add snapshot results to the storybook spec page or what's the point?
Yes, the whole documentation is quite outdated @leetercola.
I guess you figured it out by now, but for future reference, importing storiesOf
depends on your framework as of Storybook 3.4.0-alpha.9.
import { storiesOf } from '@storybook/react';
import { storiesOf } from '@storybook/vue';
import { storiesOf } from '@storybook/angular';
As for mocking modules, __mocks__
is one of the directories Jest will search for mocks. So if you have in root modules test.js
and facade.js
like this.
facade.js
export const CONSTANT = 'hello';
test.js
import CONSTANT from './facade';
console.log(CONSTANT); // <- hello
You can place a mocked facade.js
file inside __mocks__
.
facade.js
export const CONSTANT = 'mocked';
When Jest runs your tests, this is what will happen in test.js
.
test.js
import CONSTANT from './facade'; // mocked from __mocks__ because of jest.mock() in config
console.log(CONSTANT); // <- mocked