diff --git a/e2e/next-core/src/next-appdir.test.ts b/e2e/next-core/src/next-appdir.test.ts index a57d15ddb0cf5..5a0dcc7e9319c 100644 --- a/e2e/next-core/src/next-appdir.test.ts +++ b/e2e/next-core/src/next-appdir.test.ts @@ -1,12 +1,12 @@ import { cleanupProject, - isNotWindows, + killPorts, newProject, runCLI, + runE2ETests, uniq, updateFile, } from '@nx/e2e/utils'; -import { checkApp } from './utils'; describe('Next.js App Router', () => { let proj: string; @@ -20,8 +20,7 @@ describe('Next.js App Router', () => { afterAll(() => cleanupProject()); - // TODO: enable this when tests are passing again - xit('should be able to generate and build app with default App Router', async () => { + it('should be able to generate and build app with default App Router', async () => { const appName = uniq('app'); const jsLib = uniq('tslib'); @@ -31,7 +30,7 @@ describe('Next.js App Router', () => { runCLI(`generate @nx/js:lib ${jsLib} --no-interactive`); updateFile( - `apps/${appName}/app/page.tsx`, + `apps/${appName}/src/app/page.tsx`, ` import React from 'react'; import { ${jsLib} } from '@${proj}/${jsLib}'; @@ -40,7 +39,7 @@ describe('Next.js App Router', () => { return (

{${jsLib}()}

); - }; + } ` ); @@ -58,11 +57,15 @@ describe('Next.js App Router', () => { ` ); - await checkApp(appName, { - checkUnitTest: false, - checkLint: true, - checkE2E: isNotWindows(), - checkExport: false, - }); + const lintResults = runCLI(`lint ${appName}`); + expect(lintResults).toContain('Successfully ran target lint'); + + if (runE2ETests()) { + const e2eResults = runCLI( + `e2e ${appName}-e2e --configuration=production` + ); + expect(e2eResults).toContain('Successfully ran target e2e for project'); + expect(await killPorts()).toBeTruthy(); + } }, 300_000); }); diff --git a/e2e/next-core/src/next-legacy.test.ts b/e2e/next-core/src/next-legacy.test.ts index 47613c41dc5b7..2583e4480016d 100644 --- a/e2e/next-core/src/next-legacy.test.ts +++ b/e2e/next-core/src/next-legacy.test.ts @@ -22,16 +22,11 @@ import { mkdirSync, removeSync } from 'fs-extra'; import { join } from 'path'; import { checkApp } from './utils'; -// TODO(crystal, @ndcunningham): Investigate why these tests are failing -xdescribe('@nx/next (legacy)', () => { +describe('@nx/next (legacy)', () => { let proj: string; let originalEnv: string; let packageManager; - afterEach(() => { - cleanupProject(); - }); - beforeAll(() => { proj = newProject({ packages: ['@nx/next'], @@ -99,7 +94,8 @@ xdescribe('@nx/next (legacy)', () => { }); }, 1_000_000); - it('should produce a self-contained artifact in dist', async () => { + // Reenable this test once we fix Error: Cannot find module 'ajv/dist/compile/codegen' + xit('should produce a self-contained artifact in dist', async () => { // Remove apps/libs folder and use packages. // Allows us to test other integrated monorepo setup that had a regression. // See: https://github.com/nrwl/nx/issues/16658