Skip to content

Commit

Permalink
[INTERNAL] ProjectGraph#addProject: Never ignore duplicates
Browse files Browse the repository at this point in the history
As of today, we don't known of any use case for this
  • Loading branch information
RandomByte committed Nov 4, 2022
1 parent b3a1b61 commit 1504c7a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
6 changes: 1 addition & 5 deletions lib/graph/ProjectGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@ class ProjectGraph {
*
* @public
* @param {@ui5/project/specifications/Project} project Project which should be added to the graph
* @param {boolean} [ignoreDuplicates=false] Whether an error should be thrown when a duplicate project is added
*/
addProject(project, ignoreDuplicates) {
addProject(project) {
this._checkSealed();
const projectName = project.getName();
if (this._projects[projectName]) {
if (ignoreDuplicates) {
return;
}
throw new Error(
`Failed to add project ${projectName} to graph: A project with that name has already been added`);
}
Expand Down
17 changes: 0 additions & 17 deletions test/lib/graph/ProjectGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,6 @@ test("addProject: Add duplicate", async (t) => {
t.is(res, project1, "Should return correct project");
});

test("addProject: Add duplicate with ignoreDuplicates", async (t) => {
const {ProjectGraph} = t.context;
const graph = new ProjectGraph({
rootProjectName: "my root project"
});
const project1 = await createProject("application.a");
graph.addProject(project1);

const project2 = await createProject("application.a");
t.notThrows(() => {
graph.addProject(project2, true);
}, "Should not throw when adding duplicates");

const res = graph.getProject("application.a");
t.is(res, project1, "Should return correct project");
});

test("addProject: Add project with integer-like name", async (t) => {
const {ProjectGraph} = t.context;
const graph = new ProjectGraph({
Expand Down

0 comments on commit 1504c7a

Please sign in to comment.