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

enable --force-upload to upload npm packages #266

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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 bin/helpers/checkUploaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const checkUploadedMd5 = (bsConfig, args, instrumentBlocks) => {
zipUrlPresent: false,
packageUrlPresent: false,
};
if (args["force-upload"] && !utils.isTrueString(bsConfig.run_settings.cache_dependencies)) {
if (args["force-upload"]) {
return resolve(obj);
}

Expand Down
4 changes: 2 additions & 2 deletions bin/helpers/zipUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ const uploadCypressZip = (bsConfig, md5data, packageData) => {
});
return resolve(obj);
}).catch((error) => {
purgeUploadBar(testZipUploadObj);
purgeUploadBar(npmPackageZipUploadObj);
testZipUploadObj.bar1 && purgeUploadBar(testZipUploadObj);
npmPackageZipUploadObj.bar1 && purgeUploadBar(npmPackageZipUploadObj);
return reject(error);
})
})
Expand Down
9 changes: 5 additions & 4 deletions test/unit/bin/helpers/checkUploaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe("checkUploaded", () => {
});
});

it("resolves with zipUrlPresent false and packageUrlPresent true if force-upload enabled and cache_dependencies enabled", () => {
it("resolves with zipUrlPresent false and packageUrlPresent false if force-upload enabled and cache_dependencies enabled", () => {
let requestStub = sandbox
.stub(request, "post")
.yields(null, { statusCode: 200 }, '{"npmPackageUrl":"bs://random_hashid2"}');
Expand All @@ -219,11 +219,12 @@ describe("checkUploaded", () => {
bsConfig.run_settings.cache_dependencies = true
return checkUploadedMd5rewire(bsConfig, {"force-upload": true}, instrumentBlocks)
.then((data) => {
chai.assert.deepEqual(data, { zipUrlPresent: false, packageUrlPresent: true, npm_package_md5sum: 'random_md5sum', npmPackageUrl: 'bs://random_hashid2' })
sinon.assert.calledOnce(requestStub);
sinon.assert.calledOnce(checkSpecsMd5Stub);
chai.assert.deepEqual(data, { zipUrlPresent: false, packageUrlPresent: false })
sinon.assert.notCalled(requestStub);
sinon.assert.notCalled(checkSpecsMd5Stub);
})
.catch((_error) => {
console.log(_error)
chai.assert.fail("Promise error");
});
});
Expand Down