-
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(api): Deprecated Config in favor of StrykerOptions
* Deprecate `Config`, use `StrykerOptions` instead (no `set` method) * Deprecate `ConfigEditor`, use `OptionsEditor` instead
- Loading branch information
Showing
45 changed files
with
343 additions
and
678 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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { default as Config } from './src/config/Config'; | ||
export { default as ConfigEditor } from './src/config/ConfigEditor'; | ||
export { default as defaultTempDirName } from './src/config/DefaultTempDirName'; |
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,67 +1,9 @@ | ||
import { LogLevel, MutationScoreThresholds, MutatorDescriptor, StrykerOptions, DashboardOptions, ReportType } from '../../core'; | ||
|
||
import defaultTempDirName from './DefaultTempDirName'; | ||
import { StrykerOptions } from '../../core'; | ||
import { PartialStrykerOptions } from '../../core'; | ||
|
||
/** | ||
* When configuring stryker, every option is optional | ||
* Including deep properties like `dashboard.project`. | ||
* That's why we use a `DeepPartial` mapped type here. | ||
* @deprecated Use `StrykerOptions` instead | ||
*/ | ||
type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; | ||
}; | ||
|
||
export default class Config implements StrykerOptions { | ||
[customConfig: string]: any; | ||
|
||
public files: string[]; | ||
public mutate: string[] = [ | ||
'{src,lib}/**/*.js?(x)', | ||
'!{src,lib}/**/__tests__/**/*.js?(x)', | ||
'!{src,lib}/**/?(*.)+(spec|test).js?(x)', | ||
'!{src,lib}/**/*+(Spec|Test).js?(x)' | ||
]; | ||
|
||
public logLevel: LogLevel = LogLevel.Information; | ||
public fileLogLevel: LogLevel = LogLevel.Off; | ||
public timeoutMS = 5000; | ||
public timeoutFactor = 1.5; | ||
public plugins: string[] = ['@stryker-mutator/*']; | ||
public reporters: string[] = ['html', 'progress', 'clear-text']; | ||
public coverageAnalysis: 'perTest' | 'all' | 'off' = 'off'; | ||
public testRunner: string = 'command'; | ||
public testFramework: string; | ||
public mutator: string | MutatorDescriptor = 'javascript'; | ||
public transpilers: string[] = []; | ||
public maxConcurrentTestRunners: number = Infinity; | ||
public symlinkNodeModules: boolean = true; | ||
public thresholds: MutationScoreThresholds = { | ||
break: null, | ||
high: 80, | ||
low: 60 | ||
}; | ||
|
||
public allowConsoleColors: boolean = true; | ||
/** | ||
* The options for the 'dashboard' reporter | ||
*/ | ||
public dashboard: DashboardOptions = { | ||
baseUrl: 'https://dashboard.stryker-mutator.io/api/reports', | ||
reportType: ReportType.Full | ||
}; | ||
public tempDirName: string = defaultTempDirName; | ||
|
||
public set(newConfig: DeepPartial<StrykerOptions>) { | ||
if (newConfig) { | ||
Object.keys(newConfig).forEach(key => { | ||
if (newConfig[key] !== undefined) { | ||
if (key === 'dashboard') { | ||
this[key] = { ...this[key], ...newConfig[key] }; | ||
} else { | ||
this[key] = newConfig[key]; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
export default interface Config extends StrykerOptions { | ||
set(newConfig: PartialStrykerOptions): void; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { StrykerOptions } from '../../core'; | ||
|
||
/** | ||
* Represents an OptionsEditor plugin | ||
* | ||
* OptionEditors can change the content of the stryker options at runtime. | ||
* OptionEditors are implemented as a chain of OptionEditors, the result of | ||
* any previous ConfigEditor can be passed thru to the next. Please not that | ||
* editing of the configuration object is done by reference. | ||
* | ||
*/ | ||
export interface OptionsEditor { | ||
/** | ||
* Extending classes only need to implement the edit method, this method | ||
* receives a writable config object that can be edited in any way. | ||
* Please be aware that editing is done via object reference. Therefore | ||
* the return type is void. | ||
* | ||
* @param options: The stryker configuration object | ||
*/ | ||
edit(options: StrykerOptions): void; | ||
} |
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,12 @@ | ||
import { StrykerOptions } from '../../src-generated/core'; | ||
|
||
/** | ||
* When configuring stryker, every option is optional | ||
* Including deep properties like `dashboard.project`. | ||
* That's why we use a `DeepPartial` mapped type here. | ||
*/ | ||
export type PartialStrykerOptions = DeepPartial<StrykerOptions>; | ||
|
||
type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; | ||
}; |
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 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
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 |
---|---|---|
|
@@ -15,4 +15,4 @@ | |
"path": "./tsconfig.src.json" | ||
} | ||
] | ||
} | ||
} |
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.
Oops, something went wrong.