@teamscale/coverage-collector 1.0.0-beta.4 → 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/coverage-collector",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Collector for JavaScript code coverage information",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",
@@ -20,26 +20,21 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@cqse/commons": "workspace:../cqse-commons",
23
- "argparse": "^2.0.1",
24
23
  "async": "^3.2.6",
25
24
  "axios": "^1.7.9",
26
25
  "bunyan": "^1.8.15",
27
- "date-and-time": "^3.6.0",
28
26
  "dotenv": "^16.4.7",
29
27
  "express": "^5.0.1",
30
28
  "form-data": "^4.0.2",
31
29
  "mkdirp": "^3.0.1",
32
30
  "node-cache": "^5.1.2",
33
- "rxjs": "^7.8.1",
34
31
  "source-map": "^0.7.4",
35
32
  "tmp": "^0.2.3",
36
- "typescript-optional": "^2.0.1",
37
33
  "ws": "^8.18.0"
38
34
  },
39
35
  "devDependencies": {
40
36
  "@babel/core": "^7.26.8",
41
37
  "@babel/preset-env": "^7.26.8",
42
- "@types/argparse": "^2.0.17",
43
38
  "@types/async": "^3.2.24",
44
39
  "@types/bunyan": "^1.8.11",
45
40
  "@types/express": "^5.0.0",
@@ -112,10 +112,6 @@ export declare class DataStorage {
112
112
  * Base configuration to use.
113
113
  */
114
114
  private readonly baseConfig;
115
- /**
116
- * Date format for the timestamp appended to the coverage files
117
- */
118
- readonly DATE_FORMAT = "YYYY-MM-DD-HH-mm-ss";
119
115
  /**
120
116
  * The configuration parameters the collector can be configured with.
121
117
  */
@@ -239,4 +235,8 @@ export declare class DataStorage {
239
235
  */
240
236
  addBeforeConfigUpdateCallback(callback: BeforeConfigUpdateCallback): void;
241
237
  }
238
+ /**
239
+ * Produce a string from a date to be used as a timestamp for a a file name.
240
+ */
241
+ export declare function formatTimestamp(date: Date): string;
242
242
  export {};
@@ -37,11 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.DataStorage = exports.CoverageBucket = void 0;
40
+ exports.formatTimestamp = formatTimestamp;
40
41
  const RemoteProfilerConfig_1 = require("../config/RemoteProfilerConfig");
41
42
  const commons_1 = require("@cqse/commons");
42
43
  const fs = __importStar(require("fs"));
43
44
  const path_1 = __importDefault(require("path"));
44
- const dat = __importStar(require("date-and-time"));
45
45
  /**
46
46
  * The coverage information received for one particular project/revision/application.
47
47
  */
@@ -129,10 +129,6 @@ class DataStorage {
129
129
  * Base configuration to use.
130
130
  */
131
131
  baseConfig;
132
- /**
133
- * Date format for the timestamp appended to the coverage files
134
- */
135
- DATE_FORMAT = 'YYYY-MM-DD-HH-mm-ss';
136
132
  /**
137
133
  * The configuration parameters the collector can be configured with.
138
134
  */
@@ -400,7 +396,7 @@ class DataStorage {
400
396
  if (!fs.existsSync(coverageFolder)) {
401
397
  fs.mkdirSync(coverageFolder);
402
398
  }
403
- const formattedDate = dat.format(date, this.DATE_FORMAT);
399
+ const formattedDate = formatTimestamp(date);
404
400
  if (appId) {
405
401
  return path_1.default.join(coverageFolder, sanitizeFileName(`coverage-${appId}-${formattedDate}-${commit}.simple`));
406
402
  }
@@ -482,3 +478,16 @@ function getBucketId(appId, commit) {
482
478
  function sanitizeFileName(name) {
483
479
  return name.replace(/[^a-zA-Z0-9._-]/g, '_');
484
480
  }
481
+ /**
482
+ * Produce a string from a date to be used as a timestamp for a a file name.
483
+ */
484
+ function formatTimestamp(date) {
485
+ const pad = (num) => num.toString().padStart(2, '0');
486
+ const year = date.getFullYear();
487
+ const month = pad(date.getMonth() + 1); // months are 0-based
488
+ const day = pad(date.getDate());
489
+ const hours = pad(date.getHours());
490
+ const minutes = pad(date.getMinutes());
491
+ const seconds = pad(date.getSeconds());
492
+ return `${year}-${month}-${day}-${hours}-${minutes}-${seconds}`;
493
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/coverage-collector",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Collector for JavaScript code coverage information",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",
@@ -12,42 +12,18 @@
12
12
  "dist/**/*"
13
13
  ],
14
14
  "dependencies": {
15
- "argparse": "^2.0.1",
16
15
  "async": "^3.2.6",
17
16
  "axios": "^1.7.9",
18
17
  "bunyan": "^1.8.15",
19
- "date-and-time": "^3.6.0",
20
18
  "dotenv": "^16.4.7",
21
19
  "express": "^5.0.1",
22
20
  "form-data": "^4.0.2",
23
21
  "mkdirp": "^3.0.1",
24
22
  "node-cache": "^5.1.2",
25
- "rxjs": "^7.8.1",
26
23
  "source-map": "^0.7.4",
27
24
  "tmp": "^0.2.3",
28
- "typescript-optional": "^2.0.1",
29
25
  "ws": "^8.18.0",
30
- "@cqse/commons": "1.0.0-beta.4"
31
- },
32
- "devDependencies": {
33
- "@babel/core": "^7.26.8",
34
- "@babel/preset-env": "^7.26.8",
35
- "@types/argparse": "^2.0.17",
36
- "@types/async": "^3.2.24",
37
- "@types/bunyan": "^1.8.11",
38
- "@types/express": "^5.0.0",
39
- "@types/jest": "^29.5.14",
40
- "@types/node": "^22.13.4",
41
- "@types/tmp": "^0.2.6",
42
- "@types/ws": "^8.5.14",
43
- "babel-jest": "^29.7.0",
44
- "esbuild": "^0.25.0",
45
- "jest": "^29.7.0",
46
- "mockttp": "3.15.5",
47
- "rimraf": "^6.0.1",
48
- "ts-jest": "^29.2.5",
49
- "ts-node": "^10.9.2",
50
- "typescript": "^5.7.3"
26
+ "@cqse/commons": "1.0.0-beta.5"
51
27
  },
52
28
  "publishConfig": {
53
29
  "access": "public"