Skip to content

Commit

Permalink
Use latest sauce connect 5 version by default (#277)
Browse files Browse the repository at this point in the history
* Use latest sauce connect 5 version by default

* Test getByUsername unhappy path

* decrease branches coverage requirement
  • Loading branch information
budziam authored Feb 3, 2025
1 parent a89d915 commit d0380da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
collectCoverage: true,
coverageThreshold: {
global: {
branches: 93.5,
branches: 93,
functions: 98,
lines: 97,
statements: 97,
Expand Down
4 changes: 2 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import os from 'os';

import {version} from '../package.json';

export const DEFAULT_SAUCE_CONNECT_VERSION = '5.2.2';
export const DEFAULT_SAUCE_CONNECT_VERSION = '5';
export const DEFAULT_RUNNER_NAME = 'node-saucelabs';
export const SAUCE_VERSION_NOTE = `node-saucelabs v${version}\nSauce Connect v${DEFAULT_SAUCE_CONNECT_VERSION}`;
export const SAUCE_VERSION_NOTE = `node-saucelabs v${version}\nSauce Connect v5 (latest)`;

const protocols = [
require('../apis/sauce.json'),
Expand Down
13 changes: 13 additions & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,19 @@ test('should get user by username', async () => {
expect(got.mock.calls[0]).toMatchSnapshot();
});

test('should get user by username fail when api fails', async () => {
const api = new SauceLabs({user: 'foo', key: 'bar'});
got.mockReturnValue(Promise.reject(new Error('example')));
const error = await api
.getUserByUsername({username: 'fooUser'})
.catch((err) => err);
expect(error).toEqual(
new Error(
'There was an error while fetching user information: Failed calling getUsersV1: example, undefined'
)
);
});

test('should get list of builds', async () => {
const api = new SauceLabs({user: 'foo', key: 'bar'});
got
Expand Down

0 comments on commit d0380da

Please sign in to comment.