Skip to content

Commit

Permalink
chore(storybook): storybook 7 config
Browse files Browse the repository at this point in the history
]
  • Loading branch information
mandarini committed Mar 16, 2023
1 parent 7988477 commit 1c20cff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
21 changes: 6 additions & 15 deletions e2e/storybook/src/storybook-nested.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Storybook generators for nested workspaces', () => {
});

runCLI(
`generate @nrwl/react:storybook-configuration ${appName} --generateStories --no-interactive`
`generate @nrwl/react:storybook-configuration ${appName} --generateStories --no-interactive --storybook7Configuration`
);

// TODO(jack): Overriding enhanced-resolve to 5.10.0 now until the package is fixed.
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Storybook generators for nested workspaces', () => {
const nestedAppName = uniq('other-app');
runCLI(`generate @nrwl/react:app ${nestedAppName} --no-interactive`);
runCLI(
`generate @nrwl/react:storybook-configuration ${nestedAppName} --generateStories --no-interactive`
`generate @nrwl/react:storybook-configuration ${nestedAppName} --generateStories --no-interactive --storybook7Configuration`
);
checkFilesExist(
`apps/${nestedAppName}/.storybook/main.js`,
Expand All @@ -82,12 +82,7 @@ describe('Storybook generators for nested workspaces', () => {
});
});

// TODO: Re-enable this test when Nx uses only Storybook 7 (Nx 16)
// This fails for Node 18 because Storybook 6.5 uses webpack even in non-webpack projects
// https://github.com/storybookjs/builder-vite/issues/414#issuecomment-1287536049
// https://github.com/storybookjs/storybook/issues/20209
// Error: error:0308010C:digital envelope routines::unsupported
xdescribe('serve storybook', () => {
describe('serve storybook', () => {
afterEach(() => killPorts());

it('should run a React based Storybook setup', async () => {
Expand All @@ -99,12 +94,7 @@ describe('Storybook generators for nested workspaces', () => {
}, 1000000);
});

// TODO: Re-enable this test when Nx uses only Storybook 7 (Nx 16)
// This fails for Node 18 because Storybook 6.5 uses webpack even in non-webpack projects
// https://github.com/storybookjs/builder-vite/issues/414#issuecomment-1287536049
// https://github.com/storybookjs/storybook/issues/20209
// Error: error:0308010C:digital envelope routines::unsupported
xdescribe('build storybook', () => {
describe('build storybook', () => {
it('should build and lint a React based storybook', () => {
// build
runCLI(`run ${appName}:build-storybook --verbose`);
Expand All @@ -115,7 +105,8 @@ describe('Storybook generators for nested workspaces', () => {
expect(output).toContain('All files pass linting.');
}, 1000000);

it('should build a React based storybook that references another lib', () => {
// Not sure how much sense this test makes - maybe it's noise?
xit('should build a React based storybook that references another lib', () => {
const reactLib = uniq('test-lib-react');
runCLI(`generate @nrwl/react:lib ${reactLib} --no-interactive`);
// create a React component we can reference
Expand Down
18 changes: 2 additions & 16 deletions e2e/storybook/src/storybook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
runCommandUntil,
tmpProjPath,
uniq,
updateJson,
getPackageManagerCommand,
runCommand,
getSelectedPackageManager,
Expand Down Expand Up @@ -37,17 +36,9 @@ describe('Storybook generators for non-angular projects', () => {

runCLI(`generate @nrwl/react:lib ${reactStorybookLib} --no-interactive`);
runCLI(
`generate @nrwl/react:storybook-configuration ${reactStorybookLib} --generateStories --no-interactive`
`generate @nrwl/react:storybook-configuration ${reactStorybookLib} --generateStories --no-interactive --storybook7Configuration`
);

// TODO(jack): Overriding enhanced-resolve to 5.10.0 now until the package is fixed.
// See: https://github.com/webpack/enhanced-resolve/issues/362
updateJson('package.json', (json) => {
json['overrides'] = {
'enhanced-resolve': '5.10.0',
};
return json;
});
runCommand(getPackageManagerCommand().install);
});

Expand Down Expand Up @@ -82,12 +73,7 @@ describe('Storybook generators for non-angular projects', () => {
expect(output).toContain('All files pass linting.');
}, 1000000);

// TODO: Re-enable this test when Nx uses only Storybook 7 (Nx 16)
// This fails for Node 18 because Storybook 6.5 uses webpack even in non-webpack projects
// https://github.com/storybookjs/builder-vite/issues/414#issuecomment-1287536049
// https://github.com/storybookjs/storybook/issues/20209
// Error: error:0308010C:digital envelope routines::unsupported
// Also, I am not sure how much sense this test makes - Maybe it's just adding noise
// I am not sure how much sense this test makes - Maybe it's just adding noise
xit('should build a React based storybook that references another lib', () => {
const anotherReactLib = uniq('test-another-lib-react');
runCLI(`generate @nrwl/react:lib ${anotherReactLib} --no-interactive`);
Expand Down

0 comments on commit 1c20cff

Please sign in to comment.