Skip to content

Commit 11d5e0c

Browse files
authored
Merge pull request #226 from reportportal/feature/EPMRPP-100018-remove-microseconds
EPMRPP-100018 || Revert time format back to milliseconds
2 parents 486ef70 + fc7fe0e commit 11d5e0c

File tree

6 files changed

+52
-123
lines changed

6 files changed

+52
-123
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### Changed
2+
- Revert time format back to milliseconds (based on [#217](https://github.com/reportportal/client-javascript/issues/217#issuecomment-2659843471)).
3+
This is also fixing the issue with agent installation on ARM processors.
4+
### Security
5+
- Updated versions of vulnerable packages (axios).
16

27
## [5.3.1] - 2025-01-31
38
### Fixed

__tests__/helpers.spec.js

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const os = require('os');
22
const fs = require('fs');
33
const glob = require('glob');
4-
const microtime = require('microtime');
54
const helpers = require('../lib/helpers');
65
const pjson = require('../package.json');
76

@@ -21,38 +20,9 @@ describe('Helpers', () => {
2120
});
2221
});
2322

24-
describe('formatMicrosecondsToISOString', () => {
25-
test('converts microseconds to ISO string with microseconds precision', () => {
26-
const input = 1726842755304456;
27-
const expected = '2024-09-20T14:32:35.304456Z';
28-
const result = helpers.formatMicrosecondsToISOString(input);
29-
expect(result).toBe(expected);
30-
});
31-
32-
test('handles microseconds at the start of the epoch', () => {
33-
const input = 654321;
34-
const expected = '1970-01-01T00:00:00.654321Z';
35-
const result = helpers.formatMicrosecondsToISOString(input);
36-
expect(result).toBe(expected);
37-
});
38-
39-
test('handles rounding down of microseconds correctly', () => {
40-
const input = 1000001;
41-
const expected = '1970-01-01T00:00:01.000001Z';
42-
const result = helpers.formatMicrosecondsToISOString(input);
43-
expect(result).toBe(expected);
44-
});
45-
});
46-
4723
describe('now', () => {
48-
it('should return the current timestamp with microseconds precision in ISO string format', () => {
49-
const spyMicrotime = jest.spyOn(microtime, 'now').mockReturnValue(1726842755304456);
50-
const expectedISOString = '2024-09-20T14:32:35.304456Z';
51-
52-
const result = helpers.now();
53-
54-
expect(spyMicrotime).toHaveBeenCalled();
55-
expect(result).toBe(expectedISOString);
24+
it('returns milliseconds from unix time', () => {
25+
expect(new Date() - helpers.now()).toBeLessThan(100); // less than 100 miliseconds difference
5626
});
5727
});
5828

lib/helpers.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const fs = require('fs');
22
const glob = require('glob');
33
const os = require('os');
4-
const microtime = require('microtime');
54
const RestClient = require('./rest');
65
const pjson = require('../package.json');
76

@@ -18,16 +17,8 @@ const formatName = (name) => {
1817
return (len < MIN ? name + new Array(MIN - len + 1).join('.') : name).slice(-MAX);
1918
};
2019

21-
const formatMicrosecondsToISOString = (timestampInMicroseconds) => {
22-
const milliseconds = Math.floor(timestampInMicroseconds / 1000);
23-
const microseconds = String(timestampInMicroseconds).slice(-3);
24-
const isoDate = new Date(milliseconds).toISOString();
25-
26-
return isoDate.replace('Z', `${microseconds}Z`);
27-
};
28-
2920
const now = () => {
30-
return formatMicrosecondsToISOString(microtime.now());
21+
return new Date().valueOf();
3122
};
3223

3324
// TODO: deprecate and remove
@@ -110,7 +101,6 @@ const saveLaunchUuidToFile = (launchUuid) => {
110101

111102
module.exports = {
112103
formatName,
113-
formatMicrosecondsToISOString,
114104
now,
115105
getServerResult,
116106
readLaunchesFromFile,

package-lock.json

Lines changed: 41 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
"node": ">=14.x"
2525
},
2626
"dependencies": {
27-
"axios": "^1.7.7",
27+
"axios": "^1.8.4",
2828
"axios-retry": "^4.1.0",
2929
"glob": "^8.1.0",
3030
"ini": "^2.0.0",
3131
"uniqid": "^5.4.0",
32-
"uuid": "^9.0.1",
33-
"microtime": "^3.1.1"
32+
"uuid": "^9.0.1"
3433
},
3534
"license": "Apache-2.0",
3635
"devDependencies": {

version_fragment

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
patch
1+
minor

0 commit comments

Comments
 (0)