Skip to content

Commit

Permalink
fix(core): remove and join e2e cnw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Mar 31, 2023
1 parent 77f2d0a commit a89eab1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 54 deletions.
3 changes: 3 additions & 0 deletions e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
checkFilesExist,
cleanupProject,
getSelectedPackageManager,
packageInstall,
readJson,
runCLI,
Expand All @@ -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,
});
});

Expand Down
62 changes: 8 additions & 54 deletions e2e/workspace-create/src/create-nx-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -46,6 +27,7 @@ describe('create-nx-workspace', () => {
appName: wsName,
style: 'css',
packageManager,
standaloneApi: false,
routing: false,
});

Expand All @@ -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();
});
Expand Down Expand Up @@ -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();
});
Expand Down Expand Up @@ -179,7 +159,7 @@ describe('create-nx-workspace', () => {
appName,
packageManager,
standaloneApi: false,
routing: true,
routing: false,
})
).toThrow();
});
Expand Down Expand Up @@ -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');
Expand All @@ -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',
});
Expand Down Expand Up @@ -434,7 +388,7 @@ describe('create-nx-workspace custom parent folder', () => {
mkdirSync(tmpDir, { recursive: true });

runCreateWorkspace(wsName, {
preset: 'apps',
preset: 'empty',
packageManager,
cwd: tmpDir,
});
Expand Down

0 comments on commit a89eab1

Please sign in to comment.