Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
private readonly provideLogger = (): Logger => {
return this.logger;
};
private readonly provideOptions = () => {
return this.options;
};
private readonly provideMutatorDescriptor = () => {
return this.mutatorDescriptor;
};
public pluginResolver: sinon.SinonStubbedInstance;
public options: StrykerOptions;
public mutatorDescriptor: MutatorDescriptor;
public logger: sinon.SinonStubbedInstance;
public injector: Injector = rootInjector
.provideValue(commonTokens.getLogger, this.provideLogger)
.provideFactory(commonTokens.logger, this.provideLogger, Scope.Transient)
.provideFactory(commonTokens.options, this.provideOptions, Scope.Transient)
.provideFactory(commonTokens.pluginResolver, this.providePluginResolver, Scope.Transient)
.provideFactory(commonTokens.mutatorDescriptor, this.provideMutatorDescriptor, Scope.Transient);
public reset() {
this.mutatorDescriptor = factory.mutatorDescriptor();
this.options = factory.strykerOptions();
this.logger = factory.logger();
this.pluginResolver = {
resolve: sinon.stub(),
resolveAll: sinon.stub()
};
}
}
private readonly provideLogger = (): Logger => {
return this.logger;
}
private readonly provideConfig = () => {
const config = new Config();
config.set(this.options);
return config;
}
private readonly provideOptions = () => {
return this.options;
}
public pluginResolver: sinon.SinonStubbedInstance;
public options: StrykerOptions;
public logger: sinon.SinonStubbedInstance;
public injector: Injector = rootInjector
.provideValue(commonTokens.getLogger, this.provideLogger)
.provideFactory(commonTokens.logger, this.provideLogger, Scope.Transient)
.provideFactory(commonTokens.options, this.provideOptions, Scope.Transient)
.provideFactory(commonTokens.config, this.provideConfig, Scope.Transient)
.provideFactory(commonTokens.pluginResolver, this.providePluginResolver, Scope.Transient);
public reset() {
this.options = factory.strykerOptions();
this.logger = factory.logger();
this.pluginResolver = {
resolve: sinon.stub(),
resolveAll: sinon.stub()
};
}
}
export function initializerFactory(): StrykerInitializer {
return rootInjector
.provideValue(commonTokens.getLogger, getLogger)
.provideFactory(commonTokens.logger, loggerFactory)
.provideValue(initializerTokens.out, console.log)
.provideValue(initializerTokens.strykerPresets, strykerPresets)
.provideValue(initializerTokens.restClientNpmSearch, new RestClient('npmSearch', BASE_NPM_SEARCH))
.provideValue(initializerTokens.restClientNpm, new RestClient('npm', BASE_NPM_PACKAGE))
.provideClass(initializerTokens.npmClient, NpmClient)
.provideClass(initializerTokens.configWriter, StrykerConfigWriter)
.provideClass(initializerTokens.gitignoreWriter, GitignoreWriter)
.provideClass(initializerTokens.inquirer, StrykerInquirer)
.injectClass(StrykerInitializer);
}
export function buildChildProcessInjector(options: StrykerOptions): Injector {
return rootInjector
.provideValue(commonTokens.options, options)
.provideValue(commonTokens.getLogger, getLogger)
.provideFactory(commonTokens.logger, loggerFactory, Scope.Transient)
.provideFactory(coreTokens.pluginDescriptors, pluginDescriptorsFactory)
.provideFactory(commonTokens.pluginResolver, pluginResolverFactory)
.provideFactory(commonTokens.mutatorDescriptor, mutatorDescriptorFactory);
}
export function buildChildProcessInjector(config: Config): Injector {
return rootInjector
.provideValue(commonTokens.config, config)
.provideFactory(commonTokens.options, optionsFactory)
.provideValue(commonTokens.getLogger, getLogger)
.provideFactory(commonTokens.logger, loggerFactory, Scope.Transient)
.provideFactory(coreTokens.pluginDescriptors, pluginDescriptorsFactory)
.provideFactory(commonTokens.pluginResolver, pluginResolverFactory);
}
export function buildMainInjector(cliOptions: Partial): Injector {
return rootInjector
.provideValue(commonTokens.getLogger, getLogger)
.provideFactory(commonTokens.logger, loggerFactory, Scope.Transient)
.provideValue(coreTokens.cliOptions, cliOptions)
.provideClass(coreTokens.configReader, ConfigReader)
.provideFactory(coreTokens.configReadFromConfigFile, readConfig)
.provideFactory(coreTokens.pluginDescriptors, pluginDescriptorsFactory)
.provideFactory(commonTokens.pluginResolver, pluginResolverFactory)
.provideFactory(coreTokens.pluginCreatorConfigEditor, PluginCreator.createFactory(PluginKind.ConfigEditor))
.provideClass(coreTokens.configEditorApplier, ConfigEditorApplier)
.provideFactory(commonTokens.options, optionsFactory)
.provideFactory(commonTokens.mutatorDescriptor, mutatorDescriptorFactory)
.provideFactory(coreTokens.pluginCreatorReporter, PluginCreator.createFactory(PluginKind.Reporter))
.provideFactory(coreTokens.pluginCreatorTestFramework, PluginCreator.createFactory(PluginKind.TestFramework))
.provideFactory(coreTokens.pluginCreatorMutator, PluginCreator.createFactory(PluginKind.Mutator))
.provideClass(coreTokens.reporter, BroadcastReporter)
.provideFactory(coreTokens.testFramework, testFrameworkFactory)
export function buildMainInjector(cliOptions: Partial): Injector {
return rootInjector
.provideValue(commonTokens.getLogger, getLogger)
.provideFactory(commonTokens.logger, loggerFactory, Scope.Transient)
.provideValue(coreTokens.cliOptions, cliOptions)
.provideClass(coreTokens.configReader, ConfigReader)
.provideFactory(coreTokens.configReadFromConfigFile, readConfig)
.provideFactory(coreTokens.pluginDescriptors, pluginDescriptorsFactory)
.provideFactory(commonTokens.pluginResolver, pluginResolverFactory)
.provideFactory(coreTokens.pluginCreatorConfigEditor, PluginCreator.createFactory(PluginKind.ConfigEditor))
.provideClass(coreTokens.configEditorApplier, ConfigEditorApplier)
.provideFactory(commonTokens.config, configFactory)
.provideFactory(commonTokens.options, optionsFactory)
.provideFactory(coreTokens.pluginCreatorReporter, PluginCreator.createFactory(PluginKind.Reporter))
.provideFactory(coreTokens.pluginCreatorTestFramework, PluginCreator.createFactory(PluginKind.TestFramework))
.provideFactory(coreTokens.pluginCreatorMutator, PluginCreator.createFactory(PluginKind.Mutator))
.provideClass(coreTokens.reporter, BroadcastReporter)
.provideFactory(coreTokens.testFramework, testFrameworkFactory)