diff --git a/.eslintrc.js b/.eslintrc.js index e625c42dd..50e21abcf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,7 +11,7 @@ module.exports = { SharedArrayBuffer: 'readonly' }, parserOptions: { - ecmaVersion: 2018 + ecmaVersion: 2020 }, ignorePatterns: ['assets/', 'dist/', 'node_modules/'], rules: { diff --git a/src/drivers/bitbucket_cloud.js b/src/drivers/bitbucket_cloud.js index 27abb9c89..2316fe1c1 100644 --- a/src/drivers/bitbucket_cloud.js +++ b/src/drivers/bitbucket_cloud.js @@ -380,7 +380,7 @@ class BitbucketCloud { // from BitBucket API responses: `{"error": {"message": "Error message"}}` and // `{"error": "Error message"}`, apart from plain text responses like `Bad Request`. const error = - responseBody.error.message || responseBody.error || responseBody; + responseBody?.error?.message || responseBody?.error || responseBody; throw new Error(`${response.statusText} ${error}`.trim()); } diff --git a/src/drivers/bitbucket_cloud.test.js b/src/drivers/bitbucket_cloud.test.js index 594159615..435314636 100644 --- a/src/drivers/bitbucket_cloud.test.js +++ b/src/drivers/bitbucket_cloud.test.js @@ -29,9 +29,9 @@ describe('Non Enviromental tests', () => { test('Publish', async () => { const path = `${__dirname}/../../assets/logo.png`; - await expect(client.upload({ path })).rejects.toThrow( - 'Bitbucket Cloud does not support upload!' - ); + const { uri } = await client.upload({ path }); + + expect(uri).not.toBeUndefined(); }); test('Runner token', async () => {