-
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(config injection): remove Config from the DI tokens (#1389)
BREAKING CHANGE: removed Config object from Dependency Injection (only relevant for plugin creators).
- Loading branch information
Showing
14 changed files
with
48 additions
and
76 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
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 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,2 +1,2 @@ | ||
export { ConfigEditorApplier } from './ConfigEditorApplier'; | ||
export * from './configFactory'; | ||
export * from './readConfig'; |
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,9 @@ | ||
import ConfigReader from './ConfigReader'; | ||
import { tokens } from 'stryker-api/plugin'; | ||
import { coreTokens } from '../di'; | ||
|
||
export function readConfig(configReader: ConfigReader) { | ||
return configReader.readConfig(); | ||
} | ||
|
||
readConfig.inject = tokens(coreTokens.configReader); |
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,21 +1,20 @@ | ||
import { Config } from 'stryker-api/config'; | ||
import { commonTokens, Scope, Injector, OptionsContext, tokens } from 'stryker-api/plugin'; | ||
import { optionsFactory, pluginResolverFactory, loggerFactory } from './factoryMethods'; | ||
import { pluginResolverFactory, loggerFactory } from './factoryMethods'; | ||
import { coreTokens } from '.'; | ||
import { getLogger } from 'log4js'; | ||
import { rootInjector } from 'typed-inject'; | ||
import { StrykerOptions } from 'stryker-api/core'; | ||
|
||
export function buildChildProcessInjector(config: Config): Injector<OptionsContext> { | ||
export function buildChildProcessInjector(options: StrykerOptions): Injector<OptionsContext> { | ||
return rootInjector | ||
.provideValue(commonTokens.config, config) | ||
.provideFactory(commonTokens.options, optionsFactory) | ||
.provideValue(commonTokens.options, options) | ||
.provideValue(commonTokens.getLogger, getLogger) | ||
.provideFactory(commonTokens.logger, loggerFactory, Scope.Transient) | ||
.provideFactory(coreTokens.pluginDescriptors, pluginDescriptorsFactory) | ||
.provideFactory(commonTokens.pluginResolver, pluginResolverFactory); | ||
} | ||
|
||
function pluginDescriptorsFactory(config: Config): ReadonlyArray<string> { | ||
return config.plugins; | ||
function pluginDescriptorsFactory(options: StrykerOptions): ReadonlyArray<string> { | ||
return options.plugins; | ||
} | ||
pluginDescriptorsFactory.inject = tokens(commonTokens.config); | ||
pluginDescriptorsFactory.inject = tokens(commonTokens.options); |
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