Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] versionInfoGenerator: manifest without embeds #486 #576

Merged
merged 2 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/processors/versionInfoGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ const processLibraryInfo = async (libraryInfo) => {
const bundledComponents = new Set();
libraryArtifactInfo.bundledComponents = bundledComponents;

const embeds = manifestInfo.embeds; // e.g. ["sub"]
const embeds = manifestInfo.embeds||[]; // e.g. ["sub"]
// filter only embedded manifests
const embeddedPaths = embeds.map((embed) => {
return getManifestPath(libraryInfo.libraryManifest.getPath(), embed);
Expand Down
82 changes: 82 additions & 0 deletions test/lib/processors/versionInfoGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,88 @@ test.serial("versionInfoGenerator library infos with embeds", async (t) => {
t.is(t.context.warnLogStub.callCount, 0);
});

test.serial("versionInfoGenerator library infos with no embeds", async (t) => {
const libAManifest = {
getPath: () => {
return "/resources/lib/a/manifest.json";
},
getString: async () => {
return JSON.stringify({
"sap.app": {
"id": "lib.a"
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.84",
"libs": {
"my.dep": {
"minVersion": "1.84.0",
"lazy": false
}
}
}
}
});
}
};
const libA = {name: "lib.a", version: "1.2.3", libraryManifest: libAManifest};
const myDepManifest = {
getPath: () => {
return "/resources/my/dep/manifest.json";
},
getString: async () => {
return JSON.stringify({
"sap.app": {
"id": "my.dep"
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.84",
"libs": {}
}
}
});
}
};
const myDep = {name: "my.dep", version: "1.2.3", libraryManifest: myDepManifest};
const options = {
rootProjectName: "myname", rootProjectVersion: "1.33.7", libraryInfos: [
libA, myDep
]};
const versionInfos = await versionInfoGenerator({options});

const resource = versionInfos[0];
const result = await resource.getString();

const oExpected = {
"name": "myname",
"version": "1.33.7",
"scmRevision": "",
"libraries": [
{
"name": "lib.a",
"version": "1.2.3",
"scmRevision": "",
"manifestHints": {
"dependencies": {
"libs": {
"my.dep": {}
}
}
}
},
{
"name": "my.dep",
"version": "1.2.3",
"scmRevision": ""
}
]
};
assertVersionInfoContent(t, oExpected, result);
t.is(t.context.infoLogStub.callCount, 0);
t.is(t.context.warnLogStub.callCount, 0);
});

test.serial("versionInfoGenerator library infos with embeds and embeddedBy (hasOwnPreload)", async (t) => {
const libAManifest = {
getPath: () => {
Expand Down