Skip to content

Commit

Permalink
[INTERNAL] Workspace: Log resolved versions
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Jan 30, 2023
1 parent 649107e commit 8a5c1b8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/graph/helpers/ui5Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class ProjectProcessor {
if (this._workspace) {
ui5Module = await this._workspace.getModuleByProjectName(libName);
if (ui5Module) {
log.info(`Resolved project ${libName} via ${this._workspace.getName()} workspace`);
log.info(`Resolved project ${libName} via ${this._workspace.getName()} workspace ` +
`to version ${ui5Module.getVersion()}`);
log.verbose(` Resolved module ${libName} to path ${ui5Module.getPath()}`);
log.verbose(` Requested version was: ${depMetadata.version}`);
projectIsFromWorkspace = true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/graph/providers/NodePackageDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ class NodePackageDependencies {
// If yes, replace the node from NodeProvider with the one from Workspace
const workspaceNode = await workspace.getModuleByNodeId(moduleName);
if (workspaceNode) {
log.info(`Resolved module ${moduleName} via ${workspace.getName()} workspace`);
log.verbose(`Resolved module ${moduleName} to path ${workspaceNode.getPath()}`);
log.info(`Resolved module ${moduleName} via ${workspace.getName()} workspace ` +
`to version ${workspaceNode.getVersion()}`);
log.verbose(` Resolved module ${moduleName} to path ${workspaceNode.getPath()}`);
return workspaceNode.getPath();
}
}
Expand Down
10 changes: 10 additions & 0 deletions test/lib/graph/helpers/ui5Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,8 @@ test.serial("ProjectProcessor: Resolve project via workspace", async (t) => {
getFrameworkDependencies: sinon.stub().returns([])
};
const moduleMock = {
getVersion: () => "1.0.0",
getPath: () => path.join("module", "path"),
getSpecifications: sinon.stub()
.onFirstCall().resolves({
project: libraryDProjectMock
Expand Down Expand Up @@ -1173,6 +1175,8 @@ test.serial("ProjectProcessor: Resolve project via workspace with additional dep
getFrameworkDependencies: sinon.stub().returns([])
};
const moduleMock = {
getVersion: () => "1.0.0",
getPath: () => path.join("module", "path"),
getSpecifications: sinon.stub()
.onFirstCall().resolves({
project: libraryEProjectMock
Expand Down Expand Up @@ -1239,6 +1243,8 @@ test.serial("ProjectProcessor: Resolve project via workspace with additional, un
getFrameworkDependencies: sinon.stub().returns([])
};
const moduleMock = {
getVersion: () => "1.0.0",
getPath: () => path.join("module", "path"),
getSpecifications: sinon.stub()
.onFirstCall().resolves({
project: libraryEProjectMock
Expand Down Expand Up @@ -1301,6 +1307,8 @@ test.serial("ProjectProcessor: Resolve project via workspace with cyclic depende
}])
};
const moduleMock = {
getVersion: () => "1.0.0",
getPath: () => path.join("module", "path"),
getSpecifications: sinon.stub()
.onFirstCall().resolves({
project: libraryEProjectMock
Expand Down Expand Up @@ -1368,6 +1376,8 @@ test.serial("ProjectProcessor: Resolve project via workspace with distant cyclic
}])
};
const moduleMock = {
getVersion: () => "1.0.0",
getPath: () => path.join("module", "path"),
getSpecifications: sinon.stub()
.onFirstCall().resolves({
project: libraryEProjectMock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ test("AppA: project with workspace overrides", async (t) => {
getModuleByNodeId: t.context.sinon.stub().resolves(undefined).onFirstCall().resolves({
// This version of library.d has an additional dependency to library.f,
// which in turn has a dependency to library.g
getPath: () => libraryDOverridePath
getPath: () => libraryDOverridePath,
getVersion: () => "1.0.0",
})
};
const npmProvider = new NodePackageDependenciesProvider({
Expand Down

0 comments on commit 8a5c1b8

Please sign in to comment.