apex-mutation-testing 1.7.0 → 1.7.1
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 +3 -3
- package/lib/mutator/unaryOperatorInsertionMutator.d.ts +1 -1
- package/lib/mutator/unaryOperatorInsertionMutator.js +12 -17
- package/lib/mutator/unaryOperatorInsertionMutator.js.map +1 -1
- package/npm-shrinkwrap.json +2433 -4472
- package/oclif.manifest.json +1 -1
- package/package.json +16 -13
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ sf apex mutation test run --apex-class MyClass --test-class MyClassTest
|
|
|
22
22
|
|
|
23
23
|
## What is it mutation testing ?
|
|
24
24
|
|
|
25
|
-
Mutation testing is a software testing technique that evaluates the quality of your test suite by introducing small changes (mutations) to your code and checking if your tests can detect these changes. It helps identify weaknesses in your test coverage by measuring how effectively your tests can catch intentional bugs. cf [wikipedia](https://en.wikipedia.org/wiki/Mutation_testing)
|
|
25
|
+
Mutation testing is a software testing technique that evaluates the quality of your test suite by introducing small changes (mutations) to your code and checking if your tests can detect these changes. It helps identify weaknesses in your test coverage by measuring how effectively your tests can catch intentional bugs. cf [wikipedia](https://en.wikipedia.org/wiki/Mutation_testing)
|
|
26
26
|
|
|
27
27
|
The apex-mutation-testing plugin implements this technique for Salesforce Apex code by:
|
|
28
28
|
|
|
@@ -127,7 +127,7 @@ The config file supports the following attributes:
|
|
|
127
127
|
| `threshold` | `number` | Minimum mutation score (0–100) required for the command to succeed |
|
|
128
128
|
| `skipPatterns` | `string[]` | RE2 regex patterns to skip lines from mutation (e.g., `System\\.debug`) |
|
|
129
129
|
| `lines` | `string[]` | Line ranges to restrict mutation to (e.g., `1-10`, `42`) |
|
|
130
|
-
| `mutationGrouping` | `boolean` | Pack mutations
|
|
130
|
+
| `mutationGrouping` | `boolean` | Pack mutations with disjoint tests into one deploy + run (clique → DSATUR → exact coloring). Off by default. |
|
|
131
131
|
|
|
132
132
|
**Mutual exclusivity:** You cannot specify both `include` and `exclude` within the same group.
|
|
133
133
|
For example, setting both `mutators.include` and `mutators.exclude` will result in an error.
|
|
@@ -412,7 +412,7 @@ EXAMPLES
|
|
|
412
412
|
$ sf apex mutation test run --apex-class MyClass --test-class MyClassTest --dry-run
|
|
413
413
|
```
|
|
414
414
|
|
|
415
|
-
_See code: [src/commands/apex/mutation/test/run.ts](https://github.com/scolladon/apex-mutation-testing/blob/v1.7.
|
|
415
|
+
_See code: [src/commands/apex/mutation/test/run.ts](https://github.com/scolladon/apex-mutation-testing/blob/v1.7.1/src/commands/apex/mutation/test/run.ts)_
|
|
416
416
|
<!-- commandsstop -->
|
|
417
417
|
<!-- markdownlint-enable MD040 -->
|
|
418
418
|
|
|
@@ -4,5 +4,5 @@ import { BaseListener } from './baseListener.js';
|
|
|
4
4
|
export declare class UnaryOperatorInsertionMutator extends BaseListener {
|
|
5
5
|
constructor(typeRegistry?: TypeRegistry);
|
|
6
6
|
enterPrimaryExpression(ctx: ParserRuleContext): void;
|
|
7
|
-
private
|
|
7
|
+
private isNonAssignableReceiver;
|
|
8
8
|
}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArrayExpressionContext, DotExpressionContext, IdPrimaryContext, } from 'apex-parser';
|
|
2
2
|
import { BaseListener } from './baseListener.js';
|
|
3
3
|
export class UnaryOperatorInsertionMutator extends BaseListener {
|
|
4
4
|
constructor(typeRegistry) {
|
|
5
5
|
super(typeRegistry);
|
|
6
6
|
}
|
|
7
7
|
enterPrimaryExpression(ctx) {
|
|
8
|
+
if (this.isNonAssignableReceiver(ctx)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
8
11
|
if (ctx.childCount !== 1) {
|
|
9
12
|
return;
|
|
10
13
|
}
|
|
11
14
|
const primary = ctx.getChild(0);
|
|
12
|
-
if (!(primary instanceof
|
|
15
|
+
if (!(primary instanceof IdPrimaryContext)) {
|
|
13
16
|
return;
|
|
14
17
|
}
|
|
15
18
|
const text = primary.text;
|
|
16
|
-
if (this.isLiteral(text)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (text === 'this' || text === 'super') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
19
|
if (this.typeRegistry) {
|
|
23
20
|
const methodName = this.getEnclosingMethodName(ctx);
|
|
24
21
|
if (methodName && !this.typeRegistry.isNumericOperand(methodName, text)) {
|
|
@@ -39,15 +36,13 @@ export class UnaryOperatorInsertionMutator extends BaseListener {
|
|
|
39
36
|
this.createMutation(ctx.start, ctx.stop, text, `--${text}`);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return true;
|
|
50
|
-
return false;
|
|
39
|
+
// The receiver of a dot (`a.b`) or array (`a[i]`) access is not an assignable
|
|
40
|
+
// target: `a++.b` / `a++[i]` are invalid. The index of `a[i]` is assignable, so
|
|
41
|
+
// only the receiver (first child) of an ArrayExpression is rejected.
|
|
42
|
+
isNonAssignableReceiver(ctx) {
|
|
43
|
+
const parent = ctx.parent;
|
|
44
|
+
return (parent instanceof DotExpressionContext ||
|
|
45
|
+
(parent instanceof ArrayExpressionContext && parent.expression(0) === ctx));
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
//# sourceMappingURL=unaryOperatorInsertionMutator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unaryOperatorInsertionMutator.js","sourceRoot":"","sources":["../../src/mutator/unaryOperatorInsertionMutator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unaryOperatorInsertionMutator.js","sourceRoot":"","sources":["../../src/mutator/unaryOperatorInsertionMutator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,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