Skip to content

Commit

Permalink
chore(nextjs): better error & TODO explanation for failing e2e (nrwl#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini authored Feb 2, 2024
1 parent 369ed35 commit 433d5f2
Showing 1 changed file with 17 additions and 30 deletions.
47 changes: 17 additions & 30 deletions e2e/next-extensions/src/next-storybook.test.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
import {
checkFilesExist,
cleanupProject,
getPackageManagerCommand,
getSelectedPackageManager,
newProject,
runCLI,
runCommand,
uniq,
} from '@nx/e2e/utils';

const pmc = getPackageManagerCommand({
packageManager: getSelectedPackageManager(),
});
// TODO(crystal, @mandarini): Investigate why this test is failing
// TODO(katerina): Enable some time?
// This test fails because of sharp. In this PR I have included all related links to the issue.
xdescribe('Next.js Storybook', () => {
let proj: string;

beforeAll(
() =>
(proj = newProject({
name: 'proj',
packageManager: 'npm',
packages: ['@nx/next', '@nx/react'],
}))
);

afterAll(() => cleanupProject());

it('should run a Next.js based Storybook setup', async () => {
const appName = uniq('app');

runCLI(`generate @nx/next:app ${appName} --no-interactive`);
const appName = uniq('app');
beforeAll(() => {
newProject({
name: 'proj',
packageManager: 'npm',
packages: ['@nx/next'],
});
runCLI(
`generate @nx/next:component Foo --project=${appName} --no-interactive`
`generate @nx/next:app ${appName} --e2eTestRunner=none --project-name-and-root-format=as-provided --no-interactive`
);

runCLI(
`generate @nx/react:storybook-configuration ${appName} --generateStories --no-interactive`
`generate @nx/next:component Foo --directory=${appName}/components/foo/Foo.tsx --no-interactive`
);
});

// It seems that we need to run install twice for some reason.
// This is only true on CI. On normal repos, it works as expected.
runCommand(pmc.install);
afterAll(() => cleanupProject());

it('should run a Next.js based Storybook setup', async () => {
runCLI(
`generate @nx/next:storybook-configuration ${appName} --generateStories --no-interactive`
);
runCLI(`build-storybook ${appName}`);
checkFilesExist(`${appName}/storybook-static/index.html`);
}, 600_000);
Expand Down

0 comments on commit 433d5f2

Please sign in to comment.