Skip to content

Commit

Permalink
fix(angular): remote port incrementer when no targets (#9452)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Mar 22, 2022
1 parent 9229393 commit f88018a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/angular/src/generators/mfe-remote/mfe-remote.spec.ts
Expand Up @@ -77,4 +77,18 @@ describe('MFE Remote App Generator', () => {
const project = readProjectConfiguration(tree, 'test');
expect(project.targets.serve.options.port).toEqual(4202);
});

it('should generate a remote mfe app and automatically find the next port available even when there are no other targets', async () => {
// ARRANGE
const tree = createTreeWithEmptyWorkspace(2);

// ACT
await mfeRemote(tree, {
name: 'test',
});

// ASSERT
const project = readProjectConfiguration(tree, 'test');
expect(project.targets.serve.options.port).toEqual(4201);
});
});
2 changes: 1 addition & 1 deletion packages/angular/src/generators/mfe-remote/mfe-remote.ts
Expand Up @@ -7,7 +7,7 @@ import { getMfeProjects } from '../../utils/get-mfe-projects';
function findNextAvailablePort(tree: Tree) {
const mfeProjects = getMfeProjects(tree);

const ports = new Set<number>();
const ports = new Set<number>([4200]);
for (const mfeProject of mfeProjects) {
const { targets } = readProjectConfiguration(tree, mfeProject);
const port = targets?.serve?.options?.port ?? 4200;
Expand Down

0 comments on commit f88018a

Please sign in to comment.