targeted-mutation 0.2.0 → 0.2.2

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 CHANGED
@@ -1,6 +1,10 @@
1
1
  # targeted-mutation
2
2
 
3
- `targeted-mutation` finds the tests your suite is missing. It watches the values your tests actually pass through comparisons, tries the smallest wrong implementation those values cannot tell apart from yours, and prints the test that would catch it.
3
+ [![npm](https://img.shields.io/npm/v/targeted-mutation.svg)](https://www.npmjs.com/package/targeted-mutation)
4
+ [![CI](https://github.com/t-k/targeted-mutation-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/t-k/targeted-mutation-ts/actions/workflows/ci.yml)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
+
7
+ **Targeted mutation testing for JavaScript and TypeScript**: `targeted-mutation` finds the tests your suite is missing. It watches the values your tests actually pass through comparisons, tries the smallest wrong implementation those values cannot tell apart from yours, and prints the test that would catch it.
4
8
 
5
9
  ```ts
6
10
  export const isAdult = (age: number) => age >= 18;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targeted-mutation",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Find the tests a JavaScript or TypeScript suite is missing by trying small, targeted source edits against it.",
5
5
  "keywords": [
6
6
  "mutation-testing",
@@ -43,9 +43,9 @@
43
43
  "NOTICE"
44
44
  ],
45
45
  "optionalDependencies": {
46
- "@targeted-mutation/tmt-darwin-arm64": "0.2.0",
47
- "@targeted-mutation/tmt-darwin-x64": "0.2.0",
48
- "@targeted-mutation/tmt-linux-arm64": "0.2.0",
49
- "@targeted-mutation/tmt-linux-x64": "0.2.0"
46
+ "@targeted-mutation/tmt-darwin-arm64": "0.2.2",
47
+ "@targeted-mutation/tmt-darwin-x64": "0.2.2",
48
+ "@targeted-mutation/tmt-linux-arm64": "0.2.2",
49
+ "@targeted-mutation/tmt-linux-x64": "0.2.2"
50
50
  }
51
51
  }
@@ -73,7 +73,9 @@ async function besideSession(project, files, options, run, profile, stopsSession
73
73
  mutators: profile, lines: options.lines, since: options.since, config: options.config, test: options.test,
74
74
  'copy-exclude': options['copy-exclude'], dialect: options.dialect, 'isolated-trials': options['isolated-trials'],
75
75
  concurrency: options.concurrency, 'verify-trials': options['verify-trials'], timeout: options.timeout, signal: stop.signal, extras,
76
- shardKeys: options.shardKeys, checkpointStore: options.checkpointStore, 'exclude-rule': options['exclude-rule'],
76
+ ...(options.shardKeys ? { shardKeys: options.shardKeys } : {}),
77
+ ...(options.checkpointStore ? { checkpointStore: options.checkpointStore } : {}),
78
+ ...(options['exclude-rule'] ? { 'exclude-rule': options['exclude-rule'] } : {}),
77
79
  }).then(report => ({ report }), error => ({ error }));
78
80
  let prepared;
79
81
  try {
@@ -138,13 +138,16 @@ export function assessTrial(trial, expectedTests, hitLimit) {
138
138
  }
139
139
  if (errors.length) {
140
140
  if (hitCount > 0) {
141
- return { status: 'killed', killedBy: 'unhandled-error', statusReason: errors.join('\n') };
141
+ const killerTests = failed.length
142
+ ? failed.map(({ id, name, file, project }) => ({ id, name, file, project }))
143
+ : [...expectedTests.values()].map(({ id, name, file, project }) => ({ id, name, file, project }));
144
+ return { status: 'killed', killedBy: 'unhandled-error', tests: killerTests, statusReason: errors.join('\n') };
142
145
  }
143
146
  return { status: 'error', statusReason: errors.join('\n') };
144
147
  }
145
148
  if (hitCount > 0 && ['failed', 'interrupted'].includes(reason) && failed.length &&
146
149
  failed.every(test => expectedTests.has(test.id)) && [...expectedTests].every(([id, test]) =>
147
- registered.has(id) || reason === 'interrupted' && !collectedModules.has(moduleKey(test)))) {
150
+ registered.has(id) || !collectedModules.has(moduleKey(test)))) {
148
151
  return { status: 'killed', tests: failed.map(({ id, name, file, project }) => ({ id, name, file, project })) };
149
152
  }
150
153
  if (hitCount > 0 && reason === 'passed' && !failed.length && [...expectedTests.keys()].every(id => actualPassed.has(id))) {