-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ignore static): allow to ignore static mutants (#3284)
Add support for `--ignoreStatic`. When `ignoreStatic` is enabled, static mutants are ignored (defaults to `false`). Static mutants can be expensive, depending on your use case. For example, 6% of mutants of `@stryker-mutator/core` are static, yet they take up > 50% of time executing tests. So it might make sense to ignore them.
- Loading branch information
Showing
36 changed files
with
500 additions
and
614 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"require": ["spec/chai-setup.js"], | ||
"spec": ["spec/*.spec.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"spec_files": [ | ||
"spec/*.spec.js" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"testEnvironment": "node", | ||
"testMatch": ["<rootDir>/spec/*.spec.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Karma configuration | ||
// Generated on Tue Nov 30 2021 09:57:14 GMT+0100 (Central European Standard Time) | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['chai', 'jasmine'], | ||
files: [ | ||
'src/**/*.js', | ||
'spec/**/*.js' | ||
], | ||
reporters: ['progress'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: false, | ||
browsers: ['ChromeHeadless'], | ||
singleRun: true, | ||
concurrency: Infinity | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
const chai = globalThis.chai ?? require('chai'); | ||
|
||
globalThis.expect = chai.expect; | ||
chai.util.addMethod(chai.Assertion.prototype, 'toEqual', function (expected) { | ||
var obj = chai.util.flag(this, 'object'); | ||
new chai.Assertion(obj).to.deep.equal(expected); | ||
}); | ||
chai.util.addMethod(chai.Assertion.prototype, 'toBe', function (expected) { | ||
var obj = chai.util.flag(this, 'object'); | ||
new chai.Assertion(obj).to.equal(expected); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
const concat = globalThis.concat ?? require('../src/concat').concat; | ||
const greet = globalThis.greet ?? require('../src/concat').greet; | ||
|
||
describe('concat', () => { | ||
it('should concat a and b', () => { | ||
expect(concat('foo', 'bar')).toBe('foobar'); | ||
}); | ||
}); | ||
|
||
describe('greet', () => { | ||
it('should greet me', () => { | ||
expect(greet('me')).toBe('👋 me') | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
|
||
const add = globalThis.add ?? require('../src/math').add; | ||
const multiply = globalThis.multiply ?? require('../src/math').multiply; | ||
|
||
describe('add', () => { | ||
it('should add two numbers', () => { | ||
expect(add(1, 2)).toBe(3); | ||
}); | ||
}); | ||
|
||
describe('multiply', () => { | ||
it('should multiply the numbers', () => { | ||
// Bad test, surviving mutant when * => / | ||
expect(multiply(2, 1)).toBe(2); | ||
}); | ||
}); | ||
|
||
// Missing describe for `addOne` -> surviving / noCoverage mutant | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
module.exports.concat = function concat(a, b){ | ||
function concat(a, b){ | ||
return `${a}${b}`; | ||
}; | ||
|
||
// Static mutant | ||
const hi = '👋'; | ||
|
||
function greet(name) { | ||
return `${hi} ${name}` | ||
} | ||
|
||
// Stryker disable all: Not useful for coverage analysis test | ||
if(typeof module === 'object') { | ||
module.exports = { | ||
concat, | ||
greet | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.