From a89eab13ba2ac595e792067501d31039ed2f1de8 Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Fri, 31 Mar 2023 12:15:46 +0200 Subject: [PATCH] fix(core): remove and join e2e cnw tests --- .../src/create-nx-workspace-npm.test.ts | 3 + .../src/create-nx-workspace.test.ts | 62 +++---------------- 2 files changed, 11 insertions(+), 54 deletions(-) diff --git a/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts b/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts index bde47d6f419db5..e4f642e05bc2ba 100644 --- a/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts +++ b/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts @@ -1,6 +1,7 @@ import { checkFilesExist, cleanupProject, + getSelectedPackageManager, packageInstall, readJson, runCLI, @@ -10,11 +11,13 @@ import { describe('create-nx-workspace --preset=npm', () => { let wsName; + const packageManager = getSelectedPackageManager() || 'pnpm'; beforeEach(() => { wsName = uniq('npm'); runCreateWorkspace(wsName, { preset: 'npm', + packageManager, }); }); diff --git a/e2e/workspace-create/src/create-nx-workspace.test.ts b/e2e/workspace-create/src/create-nx-workspace.test.ts index 76fe6a4b90eca3..682792de87e8b2 100644 --- a/e2e/workspace-create/src/create-nx-workspace.test.ts +++ b/e2e/workspace-create/src/create-nx-workspace.test.ts @@ -19,25 +19,6 @@ describe('create-nx-workspace', () => { afterEach(() => cleanupProject()); - it('should create a workspace with a single angular app at the root with routing', () => { - const wsName = uniq('angular'); - - runCreateWorkspace(wsName, { - preset: 'angular-standalone', - appName: wsName, - style: 'css', - packageManager, - standaloneApi: false, - routing: true, - }); - - checkFilesExist('package.json'); - checkFilesExist('src/app/app.routes.ts'); - checkFilesDoNotExist('tsconfig.base.json'); - checkFilesExist('project.json'); - expectCodeIsFormatted(); - }); - it('should create a workspace with a single angular app at the root without routing', () => { const wsName = uniq('angular'); @@ -46,6 +27,7 @@ describe('create-nx-workspace', () => { appName: wsName, style: 'css', packageManager, + standaloneApi: false, routing: false, }); @@ -70,6 +52,7 @@ describe('create-nx-workspace', () => { checkFilesExist('package.json'); checkFilesExist('project.json'); + checkFilesExist('src/app/app.routes.ts'); checkFilesDoNotExist('src/app/app.module.ts'); expectCodeIsFormatted(); }); @@ -123,9 +106,6 @@ describe('create-nx-workspace', () => { 'apps/.gitkeep', 'libs/.gitkeep' ); - const foreignLockFiles = Object.keys(packageManagerLockFile) - .filter((pm) => pm !== packageManager) - .map((pm) => packageManagerLockFile[pm]); expectNoAngularDevkit(); }); @@ -179,7 +159,7 @@ describe('create-nx-workspace', () => { appName, packageManager, standaloneApi: false, - routing: true, + routing: false, }) ).toThrow(); }); @@ -322,39 +302,13 @@ describe('create-nx-workspace', () => { it('should respect package manager preference', () => { const wsName = uniq('pm'); - const appName = uniq('app'); process.env.YARN_REGISTRY = `http://localhost:4872`; process.env.SELECTED_PM = 'npm'; runCreateWorkspace(wsName, { - preset: 'react-monorepo', - style: 'css', - appName, - packageManager: 'npm', - bundler: 'webpack', - }); - - checkFilesDoNotExist('yarn.lock'); - checkFilesExist('package-lock.json'); - expectCodeIsFormatted(); - process.env.SELECTED_PM = packageManager; - }); - - it('should store package manager preference for angular', () => { - const wsName = uniq('pm'); - const appName = uniq('app'); - - process.env.YARN_REGISTRY = `http://localhost:4872`; - process.env.SELECTED_PM = 'npm'; - - runCreateWorkspace(wsName, { - preset: 'angular-monorepo', - appName, - style: 'css', - packageManager: 'npm', - routing: true, - standaloneApi: false, + preset: 'empty', + packageManager, }); checkFilesDoNotExist('yarn.lock'); @@ -365,8 +319,8 @@ describe('create-nx-workspace', () => { it('should return error when ci workflow is selected but no cloud is set up', () => { const wsName = uniq('github'); - const create = runCreateWorkspace(wsName, { - preset: 'npm', + runCreateWorkspace(wsName, { + preset: 'empty', packageManager, ci: 'circleci', }); @@ -434,7 +388,7 @@ describe('create-nx-workspace custom parent folder', () => { mkdirSync(tmpDir, { recursive: true }); runCreateWorkspace(wsName, { - preset: 'apps', + preset: 'empty', packageManager, cwd: tmpDir, });