nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: saucelabs/node-saucelabs
Pull request #55 (2019-04-17 14:50:53)

fix: broken rdc endpoint
The RDC endpoint was broken due to an extra local in the uri.


Patch:
diff --git a/.gitignore b/.gitignore
index f2e9d18..b3846a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,3 +65,4 @@ package-lock.json
 /*.js
 !.eslintrc.js
 !babel.config.js
+.idea/
diff --git a/src/utils.js b/src/utils.js
index 1716a97..bb832e3 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -43,6 +43,8 @@ export function getSauceEndpoint (hostname, region, headless, protocol = 'https:
     if (!headless && hostname.split('.').length > 2) {
         subdomain = hostname.split('.')[0] + '.'
         hostname = hostname.split('.').slice(-2).join('.')
+        // RDC only has 1 endpoint for both DC's, so if the url contains `testobject` clear the `locale`
+        locale = hostname.includes('testobject') ? '' : locale
     } else if (!headless && region === 'us') {
         locale = ''
     }


Test patch:
diff --git a/tests/utils.test.js b/tests/utils.test.js
index 8b6d37e..8958a7f 100644
--- a/tests/utils.test.js
+++ b/tests/utils.test.js
@@ -20,6 +20,10 @@ test('getSauceEndpoint', () => {
         .toBe('https://api.us-west-1.saucelabs.com')
     expect(getSauceEndpoint('api.saucelabs.com', 'eu', false))
         .toBe('https://api.eu-central-1.saucelabs.com')
+    expect(getSauceEndpoint('app.testobject.com', 'eu', false))
+        .toBe('https://app.testobject.com')
+    expect(getSauceEndpoint('app.testobject.com', 'us', false))
+        .toBe('https://app.testobject.com')
 })
 
 test('toString', () => {
Repository: saucelabs/node-saucelabs
Pull request #113 (2021-04-29 20:11:13)

Use newer test-composer endpoint
The old one was deprecated a year ago.


Patch:
diff --git a/src/constants.js b/src/constants.js
index 4766182..e2bb51d 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -18,7 +18,7 @@ const protocols = [
     require('../apis/sauce.json'),
     require('../apis/rdc.json'),
     require('../apis/performance.json'),
-    require('../apis/testrunner.json'),
+    require('../apis/testcomposer.json'),
     require('../apis/datastore.json'),
     require('../apis/autonomiq.json')
 ]


Test patch:
diff --git a/apis/testrunner.json b/apis/testcomposer.json
similarity index 94%
rename from apis/testrunner.json
rename to apis/testcomposer.json
index 2e78560..cc4c2ed 100644
--- a/apis/testrunner.json
+++ b/apis/testcomposer.json
@@ -1,9 +1,9 @@
 {
   "swagger":"2.0",
   "info":{
-    "description":"A service that orchestrates the Sauce cloud as well as test runner packages.",
+    "description":"A service that orchestrates the Sauce Cloud.",
     "version":"0.1.7",
-    "title":"Testrunner Orchestrator",
+    "title":"Test-Composer",
     "termsOfService":"https://saucelabs.com/terms-of-service",
     "contact":{
       "name":"Open Source Program Office at Sauce",
@@ -12,10 +12,10 @@
     }
   },
   "externalDocs":{
-    "description":"Sauce Labs Wiki",
-    "url":"https://wiki.saucelabs.com"
+    "description":"Sauce Labs Docs",
+    "url":"https://docs.saucelabs.com"
   },
-  "basePath": "/v1/testrunner",
+  "basePath": "/v1/testcomposer",
   "servers":[
     {
       "url":"https://api.{region}.saucelabs.{tld}",
diff --git a/tests/index.test.js b/tests/index.test.js
index 89616fa..bfea736 100644
--- a/tests/index.test.js
+++ b/tests/index.test.js
@@ -322,7 +322,7 @@ test('should allow to upload files', async () => {
     expect(instances[0].append).toBeCalledWith('file[]', Buffer.from(JSON.stringify({ foo: 'bar' })), 'foobar.json')
 
     const uri = got.mock.calls[0][0]
-    expect(uri).toBe('https://api.us-west-1.saucelabs.com/v1/testrunner/jobs/some-id/assets')
+    expect(uri).toBe('https://api.us-west-1.saucelabs.com/v1/testcomposer/jobs/some-id/assets')
 
     expect(result).toEqual(body)
 })
Repository: saucelabs/node-saucelabs
Pull request #117 (2021-06-02 21:15:41)

Support APAC region
To support webdriverio/webdriverio#6964


Patch:
diff --git a/apis/datastore.json b/apis/datastore.json
index 3dbdf15..746be47 100644
--- a/apis/datastore.json
+++ b/apis/datastore.json
@@ -26,6 +26,7 @@
           "enum": [
             "us-west-1",
             "eu-central-1",
+            "apac-southeast-1",
             "staging"
           ]
         },
diff --git a/apis/performance.json b/apis/performance.json
index 30cf3e8..9b42360 100644
--- a/apis/performance.json
+++ b/apis/performance.json
@@ -16,6 +16,7 @@
           "enum":[
             "us-west-1",
             "eu-central-1",
+            "apac-southeast-1",
             "staging"
           ]
         },
diff --git a/apis/sauce.json b/apis/sauce.json
index b5a54ae..c511761 100644
--- a/apis/sauce.json
+++ b/apis/sauce.json
@@ -28,6 +28,7 @@
             "us-west-1",
             "us-east-1",
             "eu-central-1",
+            "apac-southeast-1",
             "staging"
           ]
         },
diff --git a/src/constants.js b/src/constants.js
index a56849e..94931fb 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -79,9 +79,11 @@ export const DEFAULT_OPTIONS = {
 export const ASSET_REGION_MAPPING = {
     'us': '',
     'eu': 'eu-central-1.',
+    'apac': 'apac-southeast-1',
     'us-west-1': '',
     'us-east-1': 'us-east-1.',
     'eu-central-1': 'eu-central-1.',
+    'apac-southeast-1': 'apac-southeast-1',
     'staging': 'staging.'
 }
 
diff --git a/src/utils.js b/src/utils.js
index 3ecb5d0..217de5c 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -35,6 +35,7 @@ export function getRegionSubDomain (options = {}) {
 
     if (options.region === 'us') region = 'us-west-1'
     if (options.region === 'eu') region = 'eu-central-1'
+    if (options.region === 'apac') region = 'apac-southeast-1'
     if (options.headless) region = 'us-east-1'
     return region
 }


Test patch:
diff --git a/apis/testcomposer.json b/apis/testcomposer.json
index cc4c2ed..1d05ab7 100644
--- a/apis/testcomposer.json
+++ b/apis/testcomposer.json
@@ -26,6 +26,7 @@
           "enum":[
             "us-west-1",
             "eu-central-1",
+            "apac-southeast-1",
             "staging"
           ]
         },
diff --git a/tests/utils.test.js b/tests/utils.test.js
index 087b437..c0207a9 100644
--- a/tests/utils.test.js
+++ b/tests/utils.test.js
@@ -24,6 +24,8 @@ test('getAPIHost', () => {
         .toBe('https://api.us-west-1.saucelabs.com/rest')
     expect(getAPIHost(sauceAPI.servers, sauceAPI.basePath, { region: 'us-east-1' }))
         .toBe('https://api.us-east-1.saucelabs.com/rest')
+    expect(getAPIHost(sauceAPI.servers, sauceAPI.basePath, { region: 'apac' }))
+        .toBe('https://api.apac-southeast-1.saucelabs.com/rest')
     expect(getAPIHost(sauceAPI.servers, sauceAPI.basePath, { region: 'us-west-1', headless: true }))
         .toBe('https://api.us-east-1.saucelabs.com/rest')
     expect(() => getAPIHost(sauceAPI.servers, sauceAPI.basePath, { region: 'foobar' }))
Repository: saucelabs/node-saucelabs
Pull request #123 (2021-10-05 23:28:59)

File Upload: Support for buffer
Currently, when providing a buffer in `_uploadJobAssets`, it's stringified + transformed into a buffer.

When trying to upload an asset which is a binary file read from the disk, it break the file.
This fix is to avoid that.

**_Use case:_**
Uploading a media and rename it. To avoid writing on the disk, reading the file + passing it as a buffer with a specified filename is more convenient.

Real world use-case: https://github.com/saucelabs/sauce-cypress-plugin/pull/2/files#diff-a30b901031c7401c0e5f13a547d0054062e611908d18401734d91132169e8ad0R111



Patch:
diff --git a/src/index.js b/src/index.js
index 956d741..c364f59 100644
--- a/src/index.js
+++ b/src/index.js
@@ -374,6 +374,8 @@ export default class SauceLabs {
                     contentType: 'text/plain',
                     knownLength: stats.size
                 })
+            } else if (file && typeof file.filename === 'string' && Buffer.isBuffer(file.data)) {
+                body.append('file[]', file.data, file.filename)
             } else if (file && typeof file.filename === 'string') {
                 body.append('file[]', Buffer.from(JSON.stringify(file.data)), file.filename)
             } else {


Test patch:
diff --git a/tests/index.test.js b/tests/index.test.js
index bfea736..17f08dc 100644
--- a/tests/index.test.js
+++ b/tests/index.test.js
@@ -300,6 +300,10 @@ test('should allow to upload files', async () => {
         files: [
             'log.json',
             'selenium-server.json',
+            {
+                filename: 'raw-file.json',
+                data: Buffer.from('my-raw-data', 'utf8')
+            },
             {
                 filename: 'foobar.json',
                 data: { foo: 'bar' }
@@ -308,7 +312,7 @@ test('should allow to upload files', async () => {
     })
 
     const { instances } = new FormData()
-    expect(instances[0].append).toBeCalledTimes(3)
+    expect(instances[0].append).toBeCalledTimes(4)
     expect(instances[0].append).toBeCalledWith(
         'file[]',
         { name: '/somefile', path: 'somepath' },
@@ -319,6 +323,7 @@ test('should allow to upload files', async () => {
             knownLength: 123
         }
     )
+    expect(instances[0].append).toBeCalledWith('file[]', Buffer.from('my-raw-data', 'utf8'), 'raw-file.json')
     expect(instances[0].append).toBeCalledWith('file[]', Buffer.from(JSON.stringify({ foo: 'bar' })), 'foobar.json')
 
     const uri = got.mock.calls[0][0]