-
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(mutators): Remove side effects from mutator plugins (#1352)
Use the new plugin system to load the `Mutator` plugins. Remove side effects from importing the existing mutator plugins: * `TypescriptMutator` * `JavascriptMutator` * `VueMutator`
- Loading branch information
Showing
62 changed files
with
637 additions
and
578 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
20 changes: 9 additions & 11 deletions
20
packages/stryker-javascript-mutator/src/JavaScriptMutator.ts
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
23 changes: 0 additions & 23 deletions
23
packages/stryker-javascript-mutator/src/NodeMutatorFactory.ts
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/helpers/NodeGenerator.ts
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import { MutatorFactory } from 'stryker-api/mutant'; | ||
import JavaScriptMutator from './JavaScriptMutator'; | ||
require('./mutators'); | ||
import { JavaScriptMutator } from './JavaScriptMutator'; | ||
import { PluginKind, declareFactoryPlugin, commonTokens, tokens, Injector, OptionsContext } from 'stryker-api/plugin'; | ||
import { NODE_MUTATORS_TOKEN } from './mutators/NodeMutator'; | ||
import { nodeMutators } from './mutators'; | ||
|
||
MutatorFactory.instance().register('javascript', JavaScriptMutator); | ||
export const strykerPlugins = [ | ||
declareFactoryPlugin(PluginKind.Mutator, 'javascript', javaScriptMutatorFactory) | ||
]; | ||
|
||
function javaScriptMutatorFactory(injector: Injector<OptionsContext>): JavaScriptMutator { | ||
return injector | ||
.provideValue(NODE_MUTATORS_TOKEN, nodeMutators) | ||
.injectClass(JavaScriptMutator); | ||
} | ||
javaScriptMutatorFactory.inject = tokens(commonTokens.injector); |
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/ArrayLiteralMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/ArrayNewExpressionMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/BinaryExpressionMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/BlockMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/BooleanSubstitutionMutator.ts
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
4 changes: 2 additions & 2 deletions
4
packages/stryker-javascript-mutator/src/mutators/ConditionalExpressionMutator.ts
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
4 changes: 2 additions & 2 deletions
4
packages/stryker-javascript-mutator/src/mutators/DoStatementMutator.ts
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
4 changes: 2 additions & 2 deletions
4
packages/stryker-javascript-mutator/src/mutators/ForStatementMutator.ts
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
4 changes: 2 additions & 2 deletions
4
packages/stryker-javascript-mutator/src/mutators/IfStatementMutator.ts
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
4 changes: 3 additions & 1 deletion
4
packages/stryker-javascript-mutator/src/mutators/NodeMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/ObjectLiteralMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/PostfixUnaryExpressionMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/PrefixUnaryExpressionMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/StringLiteralMutator.ts
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
2 changes: 1 addition & 1 deletion
2
packages/stryker-javascript-mutator/src/mutators/SwitchCaseMutator.ts
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
4 changes: 2 additions & 2 deletions
4
packages/stryker-javascript-mutator/src/mutators/WhileStatementMutator.ts
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 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
11 changes: 11 additions & 0 deletions
11
packages/stryker-javascript-mutator/test/unit/helpers/initSinon.ts
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,11 @@ | ||
import * as chai from 'chai'; | ||
import * as chaiAsPromised from 'chai-as-promised'; | ||
import * as sinon from 'sinon'; | ||
import * as sinonChai from 'sinon-chai'; | ||
import { testInjector } from '@stryker-mutator/test-helpers'; | ||
chai.use(chaiAsPromised); | ||
chai.use(sinonChai); | ||
afterEach(() => { | ||
sinon.restore(); | ||
testInjector.reset(); | ||
}); |
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.