diff --git a/CHANGELOG.md b/CHANGELOG.md index b42c68b..b260ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### Changed +- Revert time format back to milliseconds (based on [#217](https://github.com/reportportal/client-javascript/issues/217#issuecomment-2659843471)). + This is also fixing the issue with agent installation on ARM processors. +### Security +- Updated versions of vulnerable packages (axios). ## [5.3.1] - 2025-01-31 ### Fixed diff --git a/README.md b/README.md index 58bc88f..841a3ad 100644 --- a/README.md +++ b/README.md @@ -128,13 +128,13 @@ console.log(launchObj.tempId); The method takes one argument: * launch data object: -| Option | Necessity | Default | Description | -|-------------|-----------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| startTime | Optional | rpClient.helpers.now() | Start time of the launch (Unix Epoch time, see [time format](#time-format)). | -| name | Optional | parameter 'launch' specified when creating the client instance | Name of the launch. | -| mode | Optional | 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page. | -| description | Optional | '' | Description of the launch (supports markdown syntax). | -| attributes | Optional | [] | Array of launch attributes (tags). | +| Option | Necessity | Default | Description | +|-------------|-----------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| startTime | Optional | rpClient.helpers.now() | Start time of the launch (unix time). | +| name | Optional | parameter 'launch' specified when creating the client instance | Name of the launch. | +| mode | Optional | 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page. | +| description | Optional | '' | Description of the launch (supports markdown syntax). | +| attributes | Optional | [] | Array of launch attributes (tags). | | id | Optional | Not set | `ID` of the existing launch in which tests data would be sent, without this param new launch instance will be created. | To get the real launch `ID` (also known as launch `UUID` from database) wait for the returned promise to finish. @@ -179,9 +179,9 @@ The method takes two arguments: * launch `tempId` (returned by the method `startLaunch`) * data object: -|Option | Necessity | Default | Description | -|--------- |-----------|---------|----------------------------------------------------------------------------------------------------| -|endTime | Optional | rpClient.helpers.now() | End time of the launch (Unix Epoch time, see [time format](#time-format)). | +|Option | Necessity | Default | Description | +|--------- |-----------|---------|---------------------------------------------------------------------------------------------------| +|endTime | Optional | rpClient.helpers.now() | End time of the launch. | |status | Optional | '' | Status of launch, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'. | ### getPromiseFinishAllItems @@ -264,7 +264,7 @@ The method takes three arguments: |type | Required | | Test item type, one of 'SUITE', 'STORY', 'TEST', 'SCENARIO', 'STEP', 'BEFORE_CLASS', 'BEFORE_GROUPS','BEFORE_METHOD', 'BEFORE_SUITE', 'BEFORE_TEST', 'AFTER_CLASS', 'AFTER_GROUPS', 'AFTER_METHOD', 'AFTER_SUITE', 'AFTER_TEST' | |hasStats | Optional | true | Changes behavior for test item of type 'STEP'. When set to `true`, step is treaten as a test case (entity containig statistics). When false, step becomes a nested step. | |description | Optional | '' | Description of the test item (supports markdown syntax). | -|startTime | Optional | rpClient.helpers.now() | Start time of the test item (Unix Epoch time, see [time format](#time-format)). | +|startTime | Optional | rpClient.helpers.now() | Start time of the test item (unix time). | |attributes | Optional | [] | Array of the test item attributes. | * launch `tempId` (returned by the method `startLaunch`) @@ -288,8 +288,8 @@ The method takes two arguments: | Option | Necessity | Default | Description | |---------|-----------|------------------------|------------------------------------------------------------------------------------------------------------------------------------------| | issue | Optional | true | Test item issue object. `issueType` is required, allowable values: 'pb***', 'ab***', 'si***', 'ti***', 'nd001'. Where `***` is locator id | -| status | Optional | 'PASSED' | Test item status, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'. | -| endTime | Optional | rpClient.helpers.now() | End time of the launch (Unix Epoch time, see [time format](#time-format)). | +| status | Optional | 'PASSED' | Test item status, one of '', 'PASSED', 'FAILED', 'STOPPED', 'SKIPPED', 'INTERRUPTED', 'CANCELLED'. | +| endTime | Optional | rpClient.helpers.now() | End time of the launch (unix time). | Example issue object: ``` @@ -324,11 +324,11 @@ The method takes three arguments: * test item `tempId` (returned by method `startTestItem`) * data object: -| Option | Necessity | Default | Description | -|---------|-----------|------------------------|---------------------------------------------------------------------| -| message | Optional | '' | The log message. | +| Option | Necessity | Default | Description | +|---------|-----------|------------------------|----------------------------------------------------------------------| +| message | Optional | '' | The log message. | | level | Optional | '' | The log level, one of 'trace', 'debug', 'info', 'warn', 'error', ''. | -| time | Optional | rpClient.helpers.now() | The time of the log (Unix Epoch time, see [time format](#time-format)). | +| time | Optional | rpClient.helpers.now() | The time of the log. | * file object (optional): @@ -369,24 +369,13 @@ The method takes one argument: |-------------------------|-----------|-----------------------------------------|------------------------------------------------------------------------------------------------------------| | description | Optional | config.description or 'Merged launch' | Description of the launch (supports markdown syntax). | | attributes | Optional | config.attributes or [] | Array of launch attributes (tags). | -| endTime | Optional | rpClient.helpers.now() | End time of the launch (Unix Epoch time, see [time format](#time-format)). | +| endTime | Optional | rpClient.helpers.now() | End time of the launch (unix time) | | extendSuitesDescription | Optional | true | Whether to extend suites description or not. | | launches | Optional | ids of the launches saved to filesystem | The array of the real launch ids, not UUIDs | | mergeType | Optional | 'BASIC' | The type of the merge operation. Possible values are 'BASIC' or 'DEEP'. | | mode | Optional | config.mode or 'DEFAULT' | 'DEFAULT' - results will be submitted to Launches page, 'DEBUG' - results will be submitted to Debug page. | | name | Optional | config.launch or 'Test launch name' | Name of the launch after merge. | -## Time format - -The unix Epoch time ISO string. - -The [ReportPortal since product version 24.2]() (Service API version 5.12.0) supports the time with microsecond precision in the ISO string format (`2024-09-23T11:10:46.793546Z`). -Thus, it is recommended to report time in this format to have more accurate logs and test items order on the ReportPortal UI. - -**Note:** Reporting the time in ISO string format with millisecond precision (`2024-09-23T11:10:46.793Z`) or as a number of milliseconds (`1727089846793`) is also acceptable with microseconds automatically added as zeros on ReportPortal's API service for backward compatibility. - -The client use time with microsecond precision in the ISO string format by default since [version 5.3.0](). - # Copyright Notice Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/VERSION b/VERSION index c7cb131..9cbd011 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.3.1 +5.3.2-SNAPSHOT diff --git a/__tests__/helpers.spec.js b/__tests__/helpers.spec.js index a652647..fe65089 100644 --- a/__tests__/helpers.spec.js +++ b/__tests__/helpers.spec.js @@ -1,7 +1,6 @@ const os = require('os'); const fs = require('fs'); const glob = require('glob'); -const microtime = require('microtime'); const helpers = require('../lib/helpers'); const pjson = require('../package.json'); @@ -21,38 +20,9 @@ describe('Helpers', () => { }); }); - describe('formatMicrosecondsToISOString', () => { - test('converts microseconds to ISO string with microseconds precision', () => { - const input = 1726842755304456; - const expected = '2024-09-20T14:32:35.304456Z'; - const result = helpers.formatMicrosecondsToISOString(input); - expect(result).toBe(expected); - }); - - test('handles microseconds at the start of the epoch', () => { - const input = 654321; - const expected = '1970-01-01T00:00:00.654321Z'; - const result = helpers.formatMicrosecondsToISOString(input); - expect(result).toBe(expected); - }); - - test('handles rounding down of microseconds correctly', () => { - const input = 1000001; - const expected = '1970-01-01T00:00:01.000001Z'; - const result = helpers.formatMicrosecondsToISOString(input); - expect(result).toBe(expected); - }); - }); - describe('now', () => { - it('should return the current timestamp with microseconds precision in ISO string format', () => { - const spyMicrotime = jest.spyOn(microtime, 'now').mockReturnValue(1726842755304456); - const expectedISOString = '2024-09-20T14:32:35.304456Z'; - - const result = helpers.now(); - - expect(spyMicrotime).toHaveBeenCalled(); - expect(result).toBe(expectedISOString); + it('returns milliseconds from unix time', () => { + expect(new Date() - helpers.now()).toBeLessThan(100); // less than 100 miliseconds difference }); }); diff --git a/lib/helpers.js b/lib/helpers.js index 113d39c..4a7dcac 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,7 +1,6 @@ const fs = require('fs'); const glob = require('glob'); const os = require('os'); -const microtime = require('microtime'); const RestClient = require('./rest'); const pjson = require('../package.json'); @@ -18,16 +17,8 @@ const formatName = (name) => { return (len < MIN ? name + new Array(MIN - len + 1).join('.') : name).slice(-MAX); }; -const formatMicrosecondsToISOString = (timestampInMicroseconds) => { - const milliseconds = Math.floor(timestampInMicroseconds / 1000); - const microseconds = String(timestampInMicroseconds).slice(-3); - const isoDate = new Date(milliseconds).toISOString(); - - return isoDate.replace('Z', `${microseconds}Z`); -}; - const now = () => { - return formatMicrosecondsToISOString(microtime.now()); + return new Date().valueOf(); }; // TODO: deprecate and remove @@ -110,7 +101,6 @@ const saveLaunchUuidToFile = (launchUuid) => { module.exports = { formatName, - formatMicrosecondsToISOString, now, getServerResult, readLaunchesFromFile, diff --git a/package-lock.json b/package-lock.json index 8c99785..875d434 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,14 +6,13 @@ "packages": { "": { "name": "@reportportal/client-javascript", - "version": "5.3.0", + "version": "5.3.1", "license": "Apache-2.0", "dependencies": { - "axios": "^1.7.7", + "axios": "^1.8.4", "axios-retry": "^4.1.0", "glob": "^8.1.0", "ini": "^2.0.0", - "microtime": "^3.1.1", "uniqid": "^5.4.0", "uuid": "^9.0.1" }, @@ -275,18 +274,18 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", - "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -302,13 +301,13 @@ } }, "node_modules/@babel/helpers": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.7.tgz", - "integrity": "sha512-NlmJJtvcw72yRJRcnCmGvSi+3jDEg8qFu3z0AFoymmzLx5ERVWyzd9kVXr7Th9/8yIJi2Zc6av4Tqz3wFs8QWg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "dev": true, "dependencies": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" @@ -401,10 +400,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", - "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "dev": true, + "dependencies": { + "@babel/types": "^7.27.0" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -590,26 +592,27 @@ } }, "node_modules/@babel/template": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", - "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/template/node_modules/@babel/code-frame": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, "dependencies": { - "@babel/highlight": "^7.24.7", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -660,14 +663,13 @@ } }, "node_modules/@babel/types": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", - "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1855,9 +1857,9 @@ } }, "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -2274,9 +2276,9 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", @@ -4905,19 +4907,6 @@ "node": ">=8.6" } }, - "node_modules/microtime": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/microtime/-/microtime-3.1.1.tgz", - "integrity": "sha512-to1r7o24cDsud9IhN6/8wGmMx5R2kT0w2Xwm5okbYI3d1dk6Xv0m+Z+jg2vS9pt+ocgQHTCtgs/YuyJhySzxNg==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^5.0.0", - "node-gyp-build": "^4.4.0" - }, - "engines": { - "node": ">= 14.13.0" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -4999,21 +4988,6 @@ "node": ">= 10.13" } }, - "node_modules/node-addon-api": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" - }, - "node_modules/node-gyp-build": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", - "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -6086,15 +6060,6 @@ "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index 6e94479..67c4d64 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,12 @@ "node": ">=14.x" }, "dependencies": { - "axios": "^1.7.7", + "axios": "^1.8.4", "axios-retry": "^4.1.0", "glob": "^8.1.0", "ini": "^2.0.0", "uniqid": "^5.4.0", - "uuid": "^9.0.1", - "microtime": "^3.1.1" + "uuid": "^9.0.1" }, "license": "Apache-2.0", "devDependencies": { diff --git a/version_fragment b/version_fragment index 9eb7b90..acb503f 100644 --- a/version_fragment +++ b/version_fragment @@ -1 +1 @@ -patch +minor