Skip to content

Commit

Permalink
Add safety to avoid featureDetection failure
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie committed Jun 26, 2024
1 parent fcf4d49 commit 3aa6c7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
14 changes: 12 additions & 2 deletions src/vcs_providers/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,18 @@ class GitHub extends Git {
// Now with our utility functions here defined, lets call them and build
// our featureObject
let tags = await this.tags(userObj, ownerRepo);
console.log("tags value");
console.log(tags);

if (!tags.ok) {
// We failed to get the tags data for featureDetection.
// This would be rather difficult to occur in real life, but this safety check
// becomes necessary in testing, as the mocked endpoints won't stay alive
// after the HTTP request returns.
return {
ok: false,
content: tags
};
}

// Sort the tags into descending order
tags.content.sort((a, b) => { return semver.rcompare(a.name, b.name)} );

Expand Down
4 changes: 1 addition & 3 deletions tests/full/publish-version.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ describe("publish package versions", () => {

});

afterAll(async () => {
await new Promise(process.nextTick);

afterAll(async () => {
// Lets delete our test package versions
await database.removePackageByName("d-pulsar-package", true);

Expand Down
2 changes: 0 additions & 2 deletions tests/full/publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ describe("publish packages", () => {
});

afterAll(() => {
await new Promise(process.nextTick);

nock.cleanAll();
nock.enableNetConnect();
});
Expand Down

0 comments on commit 3aa6c7e

Please sign in to comment.