-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change ConfigWriter interface name to ConfigEditor (#357)
* Rename `ConfigWriter` -> `ConfigEditor` * Rename `ConfigWriterFactory` -> `ConfigEditorFactory` * Rename `ConfigEditor.write` -> `ConfigEditor.edit` * Also renamed all classes that implement `ConfigWriter` BREAKING CHANGE: Public api for `ConfigWriter` is renamed to `ConfigEditor`. The corresponding `write` method is renamed to `edit`. If you're using custom `ConfigWriter` plugins you should rename the `write` method to `edit`. Please update the `stryker-mocha-framework` and `stryker-karma-runner` to the latest versions as they provide the new `ConfigEditor` plugin.
- Loading branch information
1 parent
2ef22a4
commit ec4ae03
Showing
24 changed files
with
108 additions
and
102 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
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,3 @@ | ||
export {default as Config} from './src/config/Config'; | ||
export {default as ConfigWriter} from './src/config/ConfigWriter'; | ||
export {default as ConfigWriterFactory} from './src/config/ConfigWriterFactory'; | ||
export {default as ConfigEditor} from './src/config/ConfigEditor'; | ||
export {default as ConfigEditorFactory} from './src/config/ConfigEditorFactory'; |
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,7 @@ | ||
import Config from './Config'; | ||
|
||
interface ConfigEditor { | ||
edit(config: Config): void; | ||
} | ||
|
||
export default ConfigEditor; |
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,26 @@ | ||
import {Factory} from '../../core'; | ||
import ConfigEditor from './ConfigEditor'; | ||
|
||
namespace ConfigEditorFactory { | ||
|
||
/** | ||
* Represents a Factory for ConfigEditors. | ||
*/ | ||
class ConfigEditorFactory extends Factory<void, ConfigEditor> { | ||
|
||
constructor() { | ||
super('config-reader'); | ||
} | ||
} | ||
|
||
let configEditorFactory = new ConfigEditorFactory(); | ||
|
||
/** | ||
* Returns the current instance of the ConfigEditorFactory. | ||
*/ | ||
export function instance() { | ||
return <Factory<void, ConfigEditor>>configEditorFactory; | ||
} | ||
} | ||
|
||
export default ConfigEditorFactory; |
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import {Config, ConfigWriter, ConfigWriterFactory} from 'stryker-api/config'; | ||
import {Config, ConfigEditor, ConfigEditorFactory} from 'stryker-api/config'; | ||
|
||
let config: Config = new Config(); | ||
|
||
class MyConfigWriter { | ||
class MyConfigEditor { | ||
constructor() { | ||
} | ||
|
||
write(config: Config) { | ||
edit(config: Config) { | ||
config.set({ 'myConfig': true }); | ||
} | ||
} | ||
|
||
ConfigWriterFactory.instance().register('myConfigWriter', MyConfigWriter); | ||
let myConfigWriter = ConfigWriterFactory.instance().create('myConfigWriter', undefined); | ||
myConfigWriter.write(config); | ||
ConfigEditorFactory.instance().register('myConfigEditor', MyConfigEditor); | ||
let myConfigEditor = ConfigEditorFactory.instance().create('myConfigEditor', undefined); | ||
myConfigEditor.edit(config); | ||
console.log(config); |
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
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,7 +1,7 @@ | ||
import { TestRunnerFactory } from 'stryker-api/test_runner'; | ||
import { ConfigWriterFactory } from 'stryker-api/config'; | ||
import { ConfigEditorFactory } from 'stryker-api/config'; | ||
import KarmaTestRunner from './KarmaTestRunner'; | ||
import KarmaConfigWriter from './KarmaConfigWriter'; | ||
import KarmaConfigEditor from './KarmaConfigEditor'; | ||
|
||
TestRunnerFactory.instance().register('karma', KarmaTestRunner); | ||
ConfigWriterFactory.instance().register('karma', KarmaConfigWriter); | ||
ConfigEditorFactory.instance().register('karma', KarmaConfigEditor); |
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
8 changes: 4 additions & 4 deletions
8
...-mocha-framework/src/MochaConfigWriter.ts → ...-mocha-framework/src/MochaConfigEditor.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,8 +1,8 @@ | ||
import { ConfigWriterFactory } from 'stryker-api/config'; | ||
import { ConfigEditorFactory } from 'stryker-api/config'; | ||
import { TestFrameworkFactory } from 'stryker-api/test_framework'; | ||
|
||
import MochaConfigWriter from './MochaConfigWriter'; | ||
import MochaConfigEditor from './MochaConfigEditor'; | ||
import MochaTestFramework from './MochaTestFramework'; | ||
|
||
TestFrameworkFactory.instance().register('mocha', MochaTestFramework); | ||
ConfigWriterFactory.instance().register('mocha', MochaConfigWriter); | ||
ConfigEditorFactory.instance().register('mocha', MochaConfigEditor); |
Oops, something went wrong.