diff --git a/package.json b/package.json index 8609e4beb7..44e87701d5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "node": ">=12.11.0" }, "dependencies": { - "@salesforce/core": "2.24.2", + "@salesforce/core": "2.25.1", "@salesforce/kit": "^1.5.0", "@salesforce/ts-types": "^1.4.2", "archiver": "4.0.1", diff --git a/test/client/metadataTransfer.test.ts b/test/client/metadataTransfer.test.ts index 83b228422b..490a1b5a1c 100644 --- a/test/client/metadataTransfer.test.ts +++ b/test/client/metadataTransfer.test.ts @@ -190,6 +190,34 @@ describe('MetadataTransfer', () => { expect(callOrder).to.deep.equal(['firstCall1', 'firstCall2', 'secondCall1']); }); + it('should poll until timeout', async () => { + // This test ensures that the core PollingClient doesn't stop + // after 10 tries (the ts-retry-promise library default) and polls + // until the timeout is exceeded. + const { checkStatus } = operation.lifecycle; + let callCount = 0; + checkStatus.callsFake(async () => { + callCount += 1; + if (callCount > 22) { + // This is a safeguard to ensure polling stops if the timeout + // doesn't kick in. + return { done: true }; + } + return { done: false }; + }); + + try { + await operation.pollStatus(50, 1); + fail('should have thrown an error'); + } catch (err) { + expect(callCount).to.be.greaterThan(15); + expect(err.name, 'Polling function should have timed out').to.equal( + 'MetadataTransferError' + ); + expect(err.message).to.equal('Metadata API request failed: The client has timed out.'); + } + }); + it('should emit wrapped error if something goes wrong', async () => { const { checkStatus } = operation.lifecycle; const originalError = new Error('whoops'); diff --git a/yarn.lock b/yarn.lock index c1c4f3e27a..f4e0bb1f1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -245,10 +245,10 @@ mv "~2" safe-json-stringify "~1" -"@salesforce/core@2.24.2": - version "2.24.2" - resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-2.24.2.tgz#d699af286bcf00051a85c63a9c60aa8146fd8b5f" - integrity sha512-J5fPpHOKVsliQe0tH6IsSt71VLAP7vuStimxdixI4k2JBkyrGFvvJ8+O8qFQ1Je0037A0xN0haT+ky2QivAZPg== +"@salesforce/core@2.25.1": + version "2.25.1" + resolved "https://registry.npmjs.org/@salesforce/core/-/core-2.25.1.tgz#2be78b4fc824bfb69537174a0440ba35d19d8fa4" + integrity sha512-kRo1Uce8sFFXNBEu3odJ4zsFkvja+s/cmj7ICI6EvCsgwMHSLCw4P7zhqAsOJnBUim3M2qb4p0HpVtkQ4Cz3Kg== dependencies: "@salesforce/bunyan" "^2.0.0" "@salesforce/kit" "^1.5.0"