Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Oct 19, 2023
1 parent 5c533d5 commit 3076e97
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/lib/build/ProjectBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,24 @@ test("_executeCleanupTasks", async (t) => {
"BuildContext#executeCleanupTasks got called with no arguments");
});

test("instantiate new logger for every ProjectBuilder", async (t) => {
function CreateBuildLoggerMock(moduleName) {
t.is(moduleName, "ProjectBuilder", "BuildLogger created with expected moduleName");
return {};
}

const {graph, taskRepository, sinon} = t.context;
const createBuildLoggerMockSpy = sinon.spy(CreateBuildLoggerMock);
const ProjectBuilder = await esmock("../../../lib/build/ProjectBuilder.js", {
"@ui5/logger/internal/loggers/Build": createBuildLoggerMockSpy
});

new ProjectBuilder({graph, taskRepository});
new ProjectBuilder({graph, taskRepository});

t.is(createBuildLoggerMockSpy.callCount, 2, "BuildLogger is instantiated for every ProjectBuilder instance");
});


function getProcessListenerCount() {
return ["SIGHUP", "SIGINT", "SIGTERM", "SIGBREAK"].map((eventName) => {
Expand Down

0 comments on commit 3076e97

Please sign in to comment.