@teamscale/javascript-instrumenter 0.0.1-beta.10 → 0.0.1-beta.11

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/javascript-instrumenter",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.11",
4
4
  "description": "Istanbul-based coverage instrumenter with coverage forwarding via WebSockets",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",
@@ -63,11 +63,11 @@ class IstanbulInstrumenter {
63
63
  if (!taskElement.isInPlace()) {
64
64
  fs.writeFileSync(taskElement.toFile, inputFileSource);
65
65
  }
66
- return new Task_1.TaskResult(0, 0, 1, 0, 0, 0);
66
+ return new Task_1.TaskResult(0, 0, 0, 1, 0, 0, 0);
67
67
  }
68
68
  // Not all file types are supported by the instrumenter
69
69
  if (!this.isFileTypeSupported(taskElement.fromFile)) {
70
- return new Task_1.TaskResult(0, 0, 0, 1, 0, 0);
70
+ return new Task_1.TaskResult(0, 0, 0, 0, 1, 0, 0);
71
71
  }
72
72
  // Report progress
73
73
  this.logger.info(`Instrumenting "${path.basename(taskElement.fromFile)}"`);
@@ -87,7 +87,7 @@ class IstanbulInstrumenter {
87
87
  //
88
88
  if (this.shouldExcludeFromInstrumentation(sourcePattern, taskElement.fromFile, (_a = inputSourceMap === null || inputSourceMap === void 0 ? void 0 : inputSourceMap.sources) !== null && _a !== void 0 ? _a : [])) {
89
89
  fs.writeFileSync(taskElement.toFile, inputFileSource);
90
- return new Task_1.TaskResult(1, 0, 0, 0, 0, 0);
90
+ return new Task_1.TaskResult(0, 1, 0, 0, 0, 0, 0);
91
91
  }
92
92
  // The main instrumentation (adding coverage statements) is performed now:
93
93
  instrumentedSource = instrumenter
@@ -117,7 +117,7 @@ class IstanbulInstrumenter {
117
117
  //
118
118
  const vaccineSource = this.loadVaccine(collector);
119
119
  fs.writeFileSync(taskElement.toFile, `${exports.IS_INSTRUMENTED_TOKEN} ${vaccineSource} ${instrumentedSource} \n${finalSourceMap}`);
120
- return new Task_1.TaskResult(1, 0, 0, 0, 0, 0);
120
+ return new Task_1.TaskResult(1, 0, 0, 0, 0, 0, 0);
121
121
  }
122
122
  /**
123
123
  * Loads the vaccine from the vaccine file and adjusts some template parameters.
@@ -87,6 +87,8 @@ export declare class InstrumentationTask {
87
87
  export declare class TaskResult {
88
88
  /** Number of task elements that were performed (instrumented) */
89
89
  readonly translated: number;
90
+ /** Number of task elements that were excluded because of corresponding include/exclude patterns. */
91
+ readonly excluded: number;
90
92
  /** Number of instrumentations that were taken from a cache */
91
93
  readonly translatedFromCache: number;
92
94
  /** Number of skips due to a present instrumentation */
@@ -97,7 +99,7 @@ export declare class TaskResult {
97
99
  readonly failed: number;
98
100
  /** Number of warnings that were produced during the instrumentation process */
99
101
  readonly warnings: number;
100
- constructor(translated: number, translatedFromCache: number, alreadyInstrumented: number, unsupported: number, failed: number, warnings: number);
102
+ constructor(translated: number, excluded: number, translatedFromCache: number, alreadyInstrumented: number, unsupported: number, failed: number, warnings: number);
101
103
  /**
102
104
  * Returns the sum of the present task results and the given one.
103
105
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/Task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C;;GAEG;AACH,8BAAsB,kBAAkB;CAAG;AAE3C;;;GAGG;AACH,qBAAa,WAAW;IACvB,sBAAsB;IACtB,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,2BAA2B;IAC3B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,gEAAgE;IAChE,SAAgB,qBAAqB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;gBAExD,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,kBA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ACd,QAAQ,EAAE,MAAM;IAkBjB;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU;IAYnD;;OAEG;WACW,OAAO,IAAI,UAAU;IAInC;;;;OAIG;WACW,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU;IAKzC;;;;OAIG;WACW,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;CAI9C;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC7D,2CAA2C;IAC3C,SAAgB,iBAAiB,EAAE,MAAM,CAAC;gBAE9B,iBAAiB,EAAE,MAAM;CAIrC"}
@@ -120,14 +120,16 @@ exports.InstrumentationTask = InstrumentationTask;
120
120
  * A summary of executing the instrumentation task.
121
121
  */
122
122
  class TaskResult {
123
- constructor(translated, translatedFromCache, alreadyInstrumented, unsupported, failed, warnings) {
123
+ constructor(translated, excluded, translatedFromCache, alreadyInstrumented, unsupported, failed, warnings) {
124
124
  commons_1.Contract.require(translated > -1);
125
+ commons_1.Contract.require(excluded > -1);
125
126
  commons_1.Contract.require(translatedFromCache > -1);
126
127
  commons_1.Contract.require(alreadyInstrumented > -1);
127
128
  commons_1.Contract.require(unsupported > -1);
128
129
  commons_1.Contract.require(failed > -1);
129
130
  commons_1.Contract.require(warnings > -1);
130
131
  this.translated = translated;
132
+ this.excluded = excluded;
131
133
  this.translatedFromCache = translatedFromCache;
132
134
  this.alreadyInstrumented = alreadyInstrumented;
133
135
  this.unsupported = unsupported;
@@ -140,13 +142,13 @@ class TaskResult {
140
142
  * @param incBy - The task result to add (as delta).
141
143
  */
142
144
  withIncrement(incBy) {
143
- return new TaskResult(this.translated + incBy.translated, this.translatedFromCache + incBy.translatedFromCache, this.alreadyInstrumented + incBy.alreadyInstrumented, this.unsupported + incBy.unsupported, this.failed + incBy.failed, this.warnings + incBy.warnings);
145
+ return new TaskResult(this.translated + incBy.translated, this.excluded + incBy.excluded, this.translatedFromCache + incBy.translatedFromCache, this.alreadyInstrumented + incBy.alreadyInstrumented, this.unsupported + incBy.unsupported, this.failed + incBy.failed, this.warnings + incBy.warnings);
144
146
  }
145
147
  /**
146
148
  * @returns the neutral task element (adding it with {@code withIncrement} does not change the result).
147
149
  */
148
150
  static neutral() {
149
- return new TaskResult(0, 0, 0, 0, 0, 0);
151
+ return new TaskResult(0, 0, 0, 0, 0, 0, 0);
150
152
  }
151
153
  /**
152
154
  * @returns a task result signaling one error.
@@ -155,7 +157,7 @@ class TaskResult {
155
157
  */
156
158
  static error(e) {
157
159
  console.error(e);
158
- return new TaskResult(0, 0, 0, 0, 1, 0);
160
+ return new TaskResult(0, 0, 0, 0, 0, 1, 0);
159
161
  }
160
162
  /**
161
163
  * @returns a task result signaling one warning.
@@ -164,7 +166,7 @@ class TaskResult {
164
166
  */
165
167
  static warning(msg) {
166
168
  console.warn(msg);
167
- return new TaskResult(0, 0, 0, 0, 0, 1);
169
+ return new TaskResult(0, 0, 0, 0, 0, 0, 1);
168
170
  }
169
171
  }
170
172
  exports.TaskResult = TaskResult;
package/dist/src/main.js CHANGED
@@ -7,6 +7,7 @@ App_1.App.run()
7
7
  .then(result => {
8
8
  console.log('Instrumentation finished.');
9
9
  console.log(`\tInstrumented: ${result.translated}`);
10
+ console.log(`\tExcluded: ${result.excluded}`);
10
11
  console.log(`\tInstrumented from cache: ${result.translatedFromCache}`);
11
12
  console.log(`\tAlready instrumented: ${result.alreadyInstrumented}`);
12
13
  console.log(`\tUnsupported: ${result.unsupported}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/javascript-instrumenter",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.11",
4
4
  "description": "Istanbul-based coverage instrumenter with coverage forwarding via WebSockets",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",