@teamscale/coverage-collector 0.0.1-beta.3 → 0.0.1-beta.30
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/README.md +2 -7
- package/dist/package.json +10 -5
- package/dist/src/main.d.ts +5 -2
- package/dist/src/main.js +184 -30
- package/dist/src/receiver/CollectingServer.d.ts +1 -1
- package/dist/src/receiver/CollectingServer.js +5 -1
- package/dist/src/receiver/Session.d.ts +1 -1
- package/dist/src/receiver/Session.js +5 -1
- package/dist/src/storage/DataStorage.d.ts +1 -1
- package/dist/src/storage/DataStorage.js +5 -1
- package/dist/src/utils/QueryParameters.d.ts +9 -0
- package/dist/src/utils/QueryParameters.js +19 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ files in the [Teamscale Simple Coverage Format](https://docs.teamscale.com/refer
|
|
|
9
9
|
The Teamscale JavaScript Profiler consists of this Coverage Collector and the
|
|
10
10
|
[JavaScript Instrumenter](https://www.npmjs.com/package/@teamscale/javascript-instrumenter).
|
|
11
11
|
More details on using them (in combination) can be found
|
|
12
|
-
|
|
12
|
+
in the [Teamscale Documentation](https://docs.teamscale.com/howto/recording-test-coverage-for-javascript/).
|
|
13
13
|
|
|
14
14
|
The JavaScript Coverage Collector starts a server process that listens for
|
|
15
15
|
code coverage information from manually or automatically exercised (tested)
|
|
@@ -32,7 +32,7 @@ yarn build
|
|
|
32
32
|
There are several options to run the Collector. For example, via `yarn` by running
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
yarn
|
|
35
|
+
yarn collector --port 54678 --dump-to-file=./coverage.simple
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
or via `npx` by running
|
|
@@ -49,8 +49,3 @@ for example, by setting a corresponding environment variable.
|
|
|
49
49
|
export NODE_OPTIONS="$NODE_OPTIONS --max-old-space-size=8192"
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
## Publishing
|
|
53
|
-
|
|
54
|
-
The list of files to publish is defined by the `files` attribute in `package.json`.
|
|
55
|
-
The actual files packed by npm can be listed by running `npx npm-packlist`.
|
|
56
|
-
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamscale/coverage-collector",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.30",
|
|
4
4
|
"description": "Collector for JavaScript code coverage information",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -12,22 +12,26 @@
|
|
|
12
12
|
"url": "https://github.com/cqse/teamscale-javascript-profiler.git"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
15
16
|
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
16
17
|
"build": "tsc",
|
|
17
|
-
"
|
|
18
|
+
"collector": "node dist/src/main.js",
|
|
18
19
|
"test": "yarn build && NODE_OPTIONS='--experimental-vm-modules' jest --forceExit --coverage --silent=true --detectOpenHandles"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"dist/**/*"
|
|
22
23
|
],
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@cqse/commons": "^0.0.1-beta.
|
|
25
|
+
"@cqse/commons": "^0.0.1-beta.26",
|
|
25
26
|
"argparse": "^2.0.1",
|
|
26
27
|
"async": "^3.2.0",
|
|
28
|
+
"axios": "^0.24.0",
|
|
29
|
+
"dotenv": "^14.1.0",
|
|
30
|
+
"form-data": "^4.0.0",
|
|
27
31
|
"rxjs": "^7.1.0",
|
|
28
32
|
"source-map": "^0.7.3",
|
|
33
|
+
"tmp": "^0.2.1",
|
|
29
34
|
"typescript-optional": "^2.0.1",
|
|
30
|
-
"winston": "^3.3.3",
|
|
31
35
|
"ws": "^7.4.5"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
@@ -35,10 +39,11 @@
|
|
|
35
39
|
"@babel/preset-env": "^7.14.1",
|
|
36
40
|
"@types/argparse": "^2.0.5",
|
|
37
41
|
"@types/async": "^3.2.6",
|
|
42
|
+
"@types/bunyan": "^1.8.8",
|
|
38
43
|
"@types/jest": "^27.0.1",
|
|
39
44
|
"@types/node": "^15.0.1",
|
|
40
45
|
"@types/source-map": "^0.5.7",
|
|
41
|
-
"@types/
|
|
46
|
+
"@types/tmp": "^0.2.3",
|
|
42
47
|
"@types/ws": "^7.4.2",
|
|
43
48
|
"babel-jest": "^27.2.0",
|
|
44
49
|
"esbuild": "^0.13.4",
|
package/dist/src/main.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import 'dotenv/config';
|
|
2
3
|
/**
|
|
3
4
|
* The main class of the Teamscale JavaScript Collector.
|
|
4
|
-
* Used to start
|
|
5
|
+
* Used to start the collector for with a given configuration.
|
|
5
6
|
*/
|
|
6
7
|
export declare class Main {
|
|
7
8
|
/**
|
|
@@ -23,9 +24,11 @@ export declare class Main {
|
|
|
23
24
|
/**
|
|
24
25
|
* Start a timer for dumping the data, depending on the configuration.
|
|
25
26
|
*
|
|
26
|
-
* @param config - The config that determines whether
|
|
27
|
+
* @param config - The config that determines whether to do the timed dump or not.
|
|
27
28
|
* @param storage - The storage with the information to dump.
|
|
28
29
|
* @param logger - The logger to use.
|
|
29
30
|
*/
|
|
30
31
|
private static maybeStartDumpTimer;
|
|
32
|
+
private static dumpCoverage;
|
|
33
|
+
private static uploadToTeamscale;
|
|
31
34
|
}
|
package/dist/src/main.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
28
|
};
|
|
@@ -7,35 +30,82 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
30
|
exports.Main = void 0;
|
|
8
31
|
const package_json_1 = require("../package.json");
|
|
9
32
|
const argparse_1 = require("argparse");
|
|
10
|
-
const
|
|
33
|
+
const bunyan_1 = __importDefault(require("bunyan"));
|
|
11
34
|
const DataStorage_1 = require("./storage/DataStorage");
|
|
12
35
|
const CollectingServer_1 = require("./receiver/CollectingServer");
|
|
36
|
+
require("dotenv/config");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const axios_1 = __importDefault(require("axios"));
|
|
39
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
40
|
+
const QueryParameters_1 = __importDefault(require("./utils/QueryParameters"));
|
|
41
|
+
const util_1 = require("util");
|
|
42
|
+
const tmp_1 = __importDefault(require("tmp"));
|
|
43
|
+
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
44
|
+
const path_1 = __importDefault(require("path"));
|
|
13
45
|
/**
|
|
14
46
|
* The main class of the Teamscale JavaScript Collector.
|
|
15
|
-
* Used to start
|
|
47
|
+
* Used to start the collector for with a given configuration.
|
|
16
48
|
*/
|
|
17
49
|
class Main {
|
|
18
50
|
/**
|
|
19
51
|
* Construct the object for parsing the command line arguments.
|
|
20
52
|
*/
|
|
21
53
|
static buildParser() {
|
|
54
|
+
var _a;
|
|
22
55
|
const parser = new argparse_1.ArgumentParser({
|
|
23
56
|
description: 'Collector of the Teamscale JavaScript Profiler. Collects coverage information from a' +
|
|
24
57
|
'(headless) Web browser that executes code instrumented with our instrumenter.'
|
|
25
58
|
});
|
|
26
59
|
parser.add_argument('-v', '--version', { action: 'version', version: package_json_1.version });
|
|
27
60
|
parser.add_argument('-p', '--port', { help: 'The port to receive coverage information on.', default: 54678 });
|
|
28
|
-
parser.add_argument('-f', '--dump-to-file', { help: 'Target file
|
|
61
|
+
parser.add_argument('-f', '--dump-to-file', { help: 'Target file to write coverage to.' });
|
|
29
62
|
parser.add_argument('-l', '--log-to-file', { help: 'Log file', default: 'logs/collector-combined.log' });
|
|
30
63
|
parser.add_argument('-e', '--log-level', { help: 'Log level', default: 'info' });
|
|
31
|
-
parser.add_argument('-
|
|
32
|
-
help: 'Dump the coverage information to the target file every N
|
|
33
|
-
default:
|
|
64
|
+
parser.add_argument('-t', '--dump-after-mins', {
|
|
65
|
+
help: 'Dump the coverage information to the target file every N minutes.',
|
|
66
|
+
default: 360
|
|
34
67
|
});
|
|
35
68
|
parser.add_argument('-d', '--debug', {
|
|
36
69
|
help: 'Print received coverage information to the terminal?',
|
|
37
70
|
default: false
|
|
38
71
|
});
|
|
72
|
+
// Parameters for the upload to Teamscale
|
|
73
|
+
parser.add_argument('-u', '--teamscale-server-url', {
|
|
74
|
+
help: 'Upload the coverage to the given Teamscale server URL, for example, https://teamscale.dev.example.com:8080/production.',
|
|
75
|
+
default: process.env.TEAMSCALE_SERVER_URL
|
|
76
|
+
});
|
|
77
|
+
parser.add_argument('--teamscale-access-token', {
|
|
78
|
+
help: 'The API key to use for uploading to Teamscale.',
|
|
79
|
+
default: process.env.TEAMSCALE_ACCESS_TOKEN
|
|
80
|
+
});
|
|
81
|
+
parser.add_argument('--teamscale-project', {
|
|
82
|
+
help: 'The project ID to upload coverage to.',
|
|
83
|
+
default: process.env.TEAMSCALE_PROJECT
|
|
84
|
+
});
|
|
85
|
+
parser.add_argument('--teamscale-user', {
|
|
86
|
+
help: 'The user for uploading coverage to Teamscale.',
|
|
87
|
+
default: process.env.TEAMSCALE_USER
|
|
88
|
+
});
|
|
89
|
+
parser.add_argument('--teamscale-partition', {
|
|
90
|
+
help: 'The partition to upload coverage to.',
|
|
91
|
+
default: process.env.TEAMSCALE_PARTITION
|
|
92
|
+
});
|
|
93
|
+
parser.add_argument('--teamscale-revision', {
|
|
94
|
+
help: 'The revision (commit hash, version id) to upload coverage for.',
|
|
95
|
+
default: process.env.TEAMSCALE_REVISION
|
|
96
|
+
});
|
|
97
|
+
parser.add_argument('--teamscale-commit', {
|
|
98
|
+
help: 'The branch and timestamp to upload coverage for, separated by colon.',
|
|
99
|
+
default: process.env.TEAMSCALE_COMMIT
|
|
100
|
+
});
|
|
101
|
+
parser.add_argument('--teamscale-repository', {
|
|
102
|
+
help: 'The repository to upload coverage for. Optional: Only needed when uploading via revision to a project that has more than one connector.',
|
|
103
|
+
default: process.env.TEAMSCALE_REPOSITORY
|
|
104
|
+
});
|
|
105
|
+
parser.add_argument('--teamscale-message', {
|
|
106
|
+
help: 'The commit message shown within Teamscale for the coverage upload. Default is "JavaScript coverage upload".',
|
|
107
|
+
default: (_a = process.env.TEAMSCALE_MESSAGE) !== null && _a !== void 0 ? _a : 'JavaScript coverage upload'
|
|
108
|
+
});
|
|
39
109
|
return parser;
|
|
40
110
|
}
|
|
41
111
|
/**
|
|
@@ -49,16 +119,25 @@ class Main {
|
|
|
49
119
|
* Construct the logger.
|
|
50
120
|
*/
|
|
51
121
|
static buildLogger(config) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
122
|
+
const logfilePath = config.log_to_file.trim();
|
|
123
|
+
mkdirp_1.default.sync(path_1.default.dirname(logfilePath));
|
|
124
|
+
const logLevel = config.log_level;
|
|
125
|
+
return bunyan_1.default.createLogger({ name: "Instrumenter",
|
|
126
|
+
streams: [
|
|
127
|
+
{
|
|
128
|
+
level: logLevel,
|
|
129
|
+
stream: {
|
|
130
|
+
write: (rec) => {
|
|
131
|
+
console.log('[%s] %s: %s', rec.time.toISOString(), bunyan_1.default.nameFromLevel[rec.level], rec.msg);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
type: 'raw'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
level: logLevel,
|
|
138
|
+
path: logfilePath
|
|
139
|
+
}
|
|
140
|
+
] });
|
|
62
141
|
}
|
|
63
142
|
/**
|
|
64
143
|
* Entry point of the Teamscale JavaScript Profiler.
|
|
@@ -70,6 +149,11 @@ class Main {
|
|
|
70
149
|
const logger = this.buildLogger(config);
|
|
71
150
|
logger.info(`Starting collector in working directory "${process.cwd()}".`);
|
|
72
151
|
logger.info(`Logging "${config.log_level}" to "${config.log_to_file}".`);
|
|
152
|
+
// Check the command line arguments
|
|
153
|
+
if (!config.dump_to_file && !config.teamscale_server_url) {
|
|
154
|
+
logger.error('The Collector must be configured to either dump to a file or upload to Teamscale.');
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
73
157
|
// Prepare the storage and the server
|
|
74
158
|
const storage = new DataStorage_1.DataStorage(logger);
|
|
75
159
|
const server = new CollectingServer_1.WebSocketCollectingServer(config.port, storage, logger);
|
|
@@ -79,7 +163,9 @@ class Main {
|
|
|
79
163
|
// Optionally, start a timer that dumps the coverage after a N seconds
|
|
80
164
|
this.maybeStartDumpTimer(config, storage, logger);
|
|
81
165
|
// Say bye bye on CTRL+C and exit the process
|
|
82
|
-
process.on('SIGINT', () => {
|
|
166
|
+
process.on('SIGINT', async () => {
|
|
167
|
+
// ... and do a final dump before.
|
|
168
|
+
await this.dumpCoverage(config, storage, logger).then();
|
|
83
169
|
logger.info('Bye bye.');
|
|
84
170
|
process.exit();
|
|
85
171
|
});
|
|
@@ -87,32 +173,100 @@ class Main {
|
|
|
87
173
|
/**
|
|
88
174
|
* Start a timer for dumping the data, depending on the configuration.
|
|
89
175
|
*
|
|
90
|
-
* @param config - The config that determines whether
|
|
176
|
+
* @param config - The config that determines whether to do the timed dump or not.
|
|
91
177
|
* @param storage - The storage with the information to dump.
|
|
92
178
|
* @param logger - The logger to use.
|
|
93
179
|
*/
|
|
94
180
|
static maybeStartDumpTimer(config, storage, logger) {
|
|
95
|
-
if (config.
|
|
181
|
+
if (config.dump_after_mins > 0) {
|
|
182
|
+
logger.info(`Will dump coverage information every ${config.dump_after_mins} minute(s).`);
|
|
96
183
|
const timer = setInterval(() => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
logger.info(`Conducted periodic coverage dump with ${lines} lines to ${config.dump_to_file}.`);
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
logger.error('Timed coverage dump failed.', e);
|
|
103
|
-
}
|
|
104
|
-
}, config.dump_after_secs * 1000);
|
|
184
|
+
this.dumpCoverage(config, storage, logger).then();
|
|
185
|
+
}, config.dump_after_mins * 1000 * 60);
|
|
105
186
|
process.on('SIGINT', () => {
|
|
106
187
|
// Stop the timed file dump
|
|
107
188
|
if (timer) {
|
|
108
189
|
clearInterval(timer);
|
|
109
190
|
}
|
|
110
|
-
// ... and do a final dump
|
|
111
|
-
const written = storage.dumpToSimpleCoverageFile(config.dump_to_file);
|
|
112
|
-
logger.info(`\nCaught interrupt signal. Written ${written} lines of the latest coverage.`);
|
|
113
191
|
});
|
|
114
192
|
}
|
|
115
193
|
}
|
|
194
|
+
static async dumpCoverage(config, storage, logger) {
|
|
195
|
+
var _a;
|
|
196
|
+
try {
|
|
197
|
+
const deleteCoverageFileAfterUpload = !config.dump_to_file;
|
|
198
|
+
const coverageFile = (_a = config.dump_to_file) !== null && _a !== void 0 ? _a : tmp_1.default.tmpNameSync();
|
|
199
|
+
try {
|
|
200
|
+
// 1. Write coverage to a file
|
|
201
|
+
const lines = storage.dumpToSimpleCoverageFile(coverageFile);
|
|
202
|
+
logger.info(`Dumped ${lines} lines of coverage to ${coverageFile}.`);
|
|
203
|
+
// 2. Upload to Teamscale if configured
|
|
204
|
+
if (config.teamscale_server_url) {
|
|
205
|
+
await this.uploadToTeamscale(config, logger, coverageFile, lines);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
if (deleteCoverageFileAfterUpload) {
|
|
210
|
+
fs.unlinkSync(coverageFile);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (e) {
|
|
215
|
+
logger.error('Coverage dump failed.', e);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
static async uploadToTeamscale(config, logger, coverageFile, lines) {
|
|
219
|
+
if (!(config.teamscale_access_token && config.teamscale_user && config.teamscale_server_url)) {
|
|
220
|
+
logger.error('Cannot upload to Teamscale: API key and user name must be configured!');
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (lines === 0) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
logger.info('Preparing upload to Teamscale');
|
|
227
|
+
const form = new form_data_1.default();
|
|
228
|
+
form.append('report', fs.createReadStream(coverageFile), 'coverage.simple');
|
|
229
|
+
const parameters = new QueryParameters_1.default();
|
|
230
|
+
parameters.addIfDefined('format', 'SIMPLE');
|
|
231
|
+
parameters.addIfDefined('message', config.teamscale_message);
|
|
232
|
+
parameters.addIfDefined('repository', config.teamscale_repository);
|
|
233
|
+
parameters.addIfDefined('t', config.teamscale_commit);
|
|
234
|
+
parameters.addIfDefined('revision', config.teamscale_revision);
|
|
235
|
+
parameters.addIfDefined('partition', config.teamscale_partition);
|
|
236
|
+
await axios_1.default
|
|
237
|
+
.post(`${config.teamscale_server_url.replace(/\/$/, '')}/api/projects/${config.teamscale_project}/external-analysis/session/auto-create/report?${parameters.toString()}`, form, {
|
|
238
|
+
auth: {
|
|
239
|
+
username: config.teamscale_user,
|
|
240
|
+
password: config.teamscale_access_token
|
|
241
|
+
},
|
|
242
|
+
headers: {
|
|
243
|
+
Accept: '*/*',
|
|
244
|
+
'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
.catch(function (error) {
|
|
248
|
+
if (error.response) {
|
|
249
|
+
const response = error.response;
|
|
250
|
+
if (response.status >= 400) {
|
|
251
|
+
logger.error(`Upload failed with code ${response.status}: ${response.statusText}`);
|
|
252
|
+
logger.error(`Request failed with following response: ${response.data}`);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
logger.info(`Upload with status code ${response.status} finished.`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if (error.request) {
|
|
259
|
+
logger.error(`Upload request did not receive a response.`);
|
|
260
|
+
}
|
|
261
|
+
if (error.message) {
|
|
262
|
+
logger.error(`Something went wrong when uploading data: ${error.message}`);
|
|
263
|
+
logger.debug(`Details of the error: ${(0, util_1.inspect)(error)}`);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
logger.error(`Something went wrong when uploading data: ${(0, util_1.inspect)(error)}`);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
116
270
|
}
|
|
117
271
|
exports.Main = Main;
|
|
118
272
|
Main.run();
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Socket } from 'net';
|
|
3
3
|
import { IDataStorage } from '../storage/DataStorage';
|
|
4
|
-
import
|
|
4
|
+
import Logger from "bunyan";
|
|
5
5
|
/**
|
|
6
6
|
* The session maintains the relevant information for a client.
|
|
7
7
|
* One session is created for each client.
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Helper class for building HTTP query parameter strings.
|
|
5
|
+
*/
|
|
6
|
+
class QueryParameters extends URLSearchParams {
|
|
7
|
+
/**
|
|
8
|
+
* Adds a parameter if the value is defined.
|
|
9
|
+
*/
|
|
10
|
+
addIfDefined(key, value) {
|
|
11
|
+
if (value) {
|
|
12
|
+
this.append(key, value);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.delete(key);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = QueryParameters;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamscale/coverage-collector",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.30",
|
|
4
4
|
"description": "Collector for JavaScript code coverage information",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"bin": "dist/src/main.js",
|
|
@@ -12,22 +12,26 @@
|
|
|
12
12
|
"url": "https://github.com/cqse/teamscale-javascript-profiler.git"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
15
16
|
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
16
17
|
"build": "tsc",
|
|
17
|
-
"
|
|
18
|
+
"collector": "node dist/src/main.js",
|
|
18
19
|
"test": "yarn build && NODE_OPTIONS='--experimental-vm-modules' jest --forceExit --coverage --silent=true --detectOpenHandles"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"dist/**/*"
|
|
22
23
|
],
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@cqse/commons": "^0.0.1-beta.
|
|
25
|
+
"@cqse/commons": "^0.0.1-beta.26",
|
|
25
26
|
"argparse": "^2.0.1",
|
|
26
27
|
"async": "^3.2.0",
|
|
28
|
+
"axios": "^0.24.0",
|
|
29
|
+
"dotenv": "^14.1.0",
|
|
30
|
+
"form-data": "^4.0.0",
|
|
27
31
|
"rxjs": "^7.1.0",
|
|
28
32
|
"source-map": "^0.7.3",
|
|
33
|
+
"tmp": "^0.2.1",
|
|
29
34
|
"typescript-optional": "^2.0.1",
|
|
30
|
-
"winston": "^3.3.3",
|
|
31
35
|
"ws": "^7.4.5"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
@@ -35,10 +39,11 @@
|
|
|
35
39
|
"@babel/preset-env": "^7.14.1",
|
|
36
40
|
"@types/argparse": "^2.0.5",
|
|
37
41
|
"@types/async": "^3.2.6",
|
|
42
|
+
"@types/bunyan": "^1.8.8",
|
|
38
43
|
"@types/jest": "^27.0.1",
|
|
39
44
|
"@types/node": "^15.0.1",
|
|
40
45
|
"@types/source-map": "^0.5.7",
|
|
41
|
-
"@types/
|
|
46
|
+
"@types/tmp": "^0.2.3",
|
|
42
47
|
"@types/ws": "^7.4.2",
|
|
43
48
|
"babel-jest": "^27.2.0",
|
|
44
49
|
"esbuild": "^0.13.4",
|