Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(instrumentor): Allow only running specific mutants #2751

Merged
merged 25 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
461e5b2
feature(instrumenter): Allow the instrumenter to only instrument spec…
Garethp Feb 10, 2021
3c74756
feature(instrumenter): Filter out specific mutant definitions from gl…
Garethp Feb 16, 2021
281602e
feature(instrumenter): Resolve specific mutant filename to full filen…
Garethp Feb 16, 2021
f449b52
feature(instrumenter): Added testResources for instrumentor test and …
Garethp Feb 16, 2021
7c9b749
feature(instrumenter): Added an error if you try to specify mutants a…
Garethp Feb 18, 2021
497d359
feature(instrumenter): Remove extra stuff from e2e tests and change f…
Garethp Mar 3, 2021
31e438f
feature(instrumenter): Remove unnecessary RegExp calls
Garethp Mar 8, 2021
f7a836c
feature(instrumenter): Updating the snapshot for specific mutant instrum
Garethp Mar 9, 2021
8b5fc9e
feature(instrumenter): Updating import for esModulesInterop
Garethp Mar 17, 2021
b5bda7c
feature(instrumenter): Moving the validation of mutation ranges into …
Garethp Mar 18, 2021
efff6cc
feature(instrumenter): Removing leftover declaration
Garethp Mar 18, 2021
608c77c
Merge branch 'master' into feature/specific-mutants
nicojs Mar 19, 2021
91c0642
Rename `filename` -> `fileName`
nicojs Mar 19, 2021
461b08c
Rename `mutationRange` -> `mutantRanges`
nicojs Mar 19, 2021
b43f83e
Implement new mutation range matching algoritm
nicojs Mar 19, 2021
b6694dd
refactor: create and use the input module
nicojs Mar 19, 2021
9986396
refactor: declare and reuse MUTATION_RANGE_REGEX
nicojs Mar 19, 2021
13ae892
test(e2e): add additional test file
nicojs Mar 19, 2021
2b96c43
docs: document mutation range
nicojs Mar 19, 2021
809b52f
feature(instrumenter): Change the mutation range regex to accept the …
Garethp Mar 28, 2021
e0caf08
feature(instrumenter): Change the mutation range regex to allow the u…
Garethp Mar 28, 2021
e1b190c
feature(instrumenter): Update the documentation to reflect the new mu…
Garethp Mar 28, 2021
bbf70a6
feat(mutation-ranges): make sure to work with 0-based lines internally
nicojs Apr 16, 2021
d4f81d3
fix(validation): add more validation for mutation ranges
nicojs Apr 16, 2021
2fab4b1
docs: update mutation-ranges docs
nicojs Apr 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,17 @@ Default: `['{src,lib}/**/*.js?(x)', '!{src,lib}/**/__tests__/**/*.js?(x)', '!{sr
Command line: `[--mutate|-m] src/**/*.js,a.js`<br />
Config file: `"mutate": ["src/**/*.js", "a.js"]`

With `mutate` you configure the subset of files to use for mutation testing.
Generally speaking, these should be your own source files.
This is optional, as you can choose to not mutate any files at all and perform a dry-run (running only your tests without mutating).
With `mutate` you configure the subset of files to be mutated. These should be your _production code files_, and definitely not your test files.
The default will try to guess your production code files based on sane defaults. It reads like this:

* Include all js-like files inside the `src` or `lib` dir
* Except files inside `__tests__` directories and file names ending with `test` or `spec`.

It is possible to specify exactly which code blocks to mutate by means of a _mutation range_. This can be done postfixing your file with `:startLine:startColumn:endLine:endColumn`. Some examples:
* `"src/app.js:1:0:11:0"` will mutate lines 1 through 10 inside app.js (10 included).
* `"src/app.js:5:4:6:4"` will mutate from line 5, column 4 through line 6 column 4 inside app.js (columns 4 are included).

*Note:* It is not possible to combine mutation range with a globbing expression in the same line.

### `mutator` [`MutatorDescriptor`]

Expand Down
4 changes: 4 additions & 0 deletions e2e/test/mutation-range/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading