Skip to content

Commit

Permalink
Merge pull request #145 from reportportal/develop
Browse files Browse the repository at this point in the history
Release 5.1.8
  • Loading branch information
AmsterGet authored Apr 11, 2024
2 parents 64d5e8f + a2ddf3c commit b14b0f0
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install of node dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install of node dependencies
Expand All @@ -41,9 +41,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand All @@ -59,7 +59,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
releaseVersion: ${{ steps.exposeVersion.outputs.releaseVersion }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Read version
id: readVersion
run: |
Expand Down Expand Up @@ -78,9 +78,9 @@ jobs:
versionInfo: ${{ steps.readChangelogEntry.outputs.log_entry }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '12'
- name: Configure git
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Create Release
id: createRelease
uses: actions/create-release@v1
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
### Changed
- `@reportportal/client-javascript` bumped to version `5.1.3`, new `launchUuidPrintOutput` types introduced: 'FILE', 'ENVIRONMENT'.

## [5.1.7] - 2024-02-21
## Changed
### Changed
- `@reportportal/client-javascript` bumped to version `5.1.2`.
### Fixed
- Setting step id in case of existing one, thanks to [noacohen1](https://github.com/noacohen1).

## [5.1.6] - 2023-12-19
### Fixed
Expand All @@ -16,7 +20,7 @@
- `@reportportal/client-javascript` bumped to version `5.0.15`. Logging link to the launch on its finish now available by default.

## [5.1.4] - 2023-10-05
## Changed
### Changed
- `@reportportal/client-javascript` bumped to version `5.0.14`.

## [5.1.3] - 2023-09-07
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The full list of available options presented below.
| launchId | Optional | Not set | The _ID_ of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this _ID_ is provided, the launch will not be finished at the end of the run and must be finished separately. |
| restClientConfig | Optional | Not set | The object with `agent` property for configure [http(s)](https://nodejs.org/api/https.html#https_https_request_url_options_callback) client, may contain other client options eg. [`timeout`](https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests). <br/> Visit [client-javascript](https://github.com/reportportal/client-javascript) for more details. |
| launchUuidPrint | Optional | false | Whether to print the current launch UUID. |
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR'. Works only if `launchUuidPrint` set to `true`. |
| launchUuidPrintOutput | Optional | 'STDOUT' | Launch UUID printing output. Possible values: 'STDOUT', 'STDERR', 'FILE', 'ENVIRONMENT'. Works only if `launchUuidPrint` set to `true`. File format: `rp-launch-uuid-${launch_uuid}.tmp`. Env variable: `RP_LAUNCH_UUID`. |
| includeTestSteps | Optional | false | Allows you to see the test steps at the log level. |
| includePlaywrightProjectNameToCodeReference | Optional | false | Includes Playwright project name to code reference. See [`testCaseId and codeRef calculation`](#setTestCaseId). It may be useful when you want to see the different history for the same test cases within different playwright projects. |
| extendTestDescriptionWithLastError | Optional | true | If set to `true` the latest error log will be attached to the test case description. |
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.7
5.1.8-SNAPSHOT
93 changes: 68 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:coverage": "jest --coverage"
},
"dependencies": {
"@reportportal/client-javascript": "^5.1.2",
"@reportportal/client-javascript": "^5.1.3",
"strip-ansi": "6.0.1"
},
"files": [
Expand All @@ -25,7 +25,7 @@
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"axios": "^0.27.2",
"axios": "^0.28.1",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^14.0.2",
Expand Down
20 changes: 19 additions & 1 deletion src/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
isFalse,
getAttachments,
isErrorLog,
fileExists,
calculateRpStatus,
} from '../utils';
import fs from 'fs';
Expand Down Expand Up @@ -56,6 +57,23 @@ describe('testing utils', () => {
});
});

describe('fileExists', () => {
test('should return true', async () => {
jest.spyOn(fs.promises, 'stat').mockImplementationOnce(() => Promise.resolve({} as fs.Stats));

const existingFilePath = 'existing-file-path';
const isFileExist = await fileExists(existingFilePath);

expect(isFileExist).toBe(true);
});
test('should return false', async () => {
const notExistingFilePath = 'not-existing-file-path';
const isFileExist = await fileExists(notExistingFilePath);

expect(isFileExist).toBe(false);
});
});

describe('promiseErrorHandler', () => {
let spyConsoleError: jest.SpyInstance;
beforeEach(() => {
Expand Down Expand Up @@ -242,7 +260,7 @@ describe('testing utils', () => {
const file1Data = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
const file2Data = Buffer.from([1, 2, 3, 4, 5, 6, 7]);

jest.spyOn(fs, 'existsSync').mockImplementationOnce((): boolean => true);
jest.spyOn(fs.promises, 'stat').mockImplementationOnce(() => Promise.resolve({} as fs.Stats));

jest.spyOn(fs.promises, 'readFile').mockImplementationOnce(async () => file1Data);

Expand Down
17 changes: 16 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ export const sendEventToReporter = (type: string, data: any, suite?: string): vo
process.stdout.write(JSON.stringify({ type, data, suite }));
};

export const fileExists = async (filePath: string) => {
try {
await fsPromises.stat(filePath);
return true;
} catch (error) {
// ENOENT code - File does not exist
if (error.code === 'ENOENT') {
return false;
} else {
throw error;
}
}
};

export const getAttachments = async (
attachments: TestResult['attachments'],
{ uploadTrace, uploadVideo }: AttachmentsConfig = { uploadTrace: true, uploadVideo: true },
Expand Down Expand Up @@ -122,7 +136,8 @@ export const getAttachments = async (
if (body) {
fileContent = body;
} else {
if (!fs.existsSync(attachmentPath)) {
const isFileExist = await fileExists(attachmentPath);
if (!isFileExist) {
return;
}
fileContent = await fsPromises.readFile(attachmentPath);
Expand Down

0 comments on commit b14b0f0

Please sign in to comment.