Skip to content

Commit

Permalink
feat(reporter config): remove deprecated reporter config option (#1371)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removes the 'reporter' config option. Please use the 'reporters' (plural) config option instead.
  • Loading branch information
simondel authored and nicojs committed Feb 12, 2019
1 parent cb585b4 commit 2034a67
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 40 deletions.
2 changes: 1 addition & 1 deletion e2e/test/command/stryker.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = function (config) {
mutate: ['src/*.js'],
testFramework: 'mocha',
coverageAnalysis: 'off',
reporter: ['clear-text', 'event-recorder'],
reporters: ['clear-text', 'event-recorder'],
mutator: 'javascript',
maxConcurrentTestRunners: 2,
commandRunner: {
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/vue-javascript/stryker.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function (config) {
mutator: 'vue',
testFramework: 'jasmine',
testRunner: 'karma',
reporter: ['clear-text', 'event-recorder'],
reporters: ['clear-text', 'event-recorder'],
maxConcurrentTestRunners: 2,
karma: {
configFile: 'test/unit/karma.conf.js'
Expand Down
1 change: 0 additions & 1 deletion packages/stryker-api/src/config/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class Config implements StrykerOptions {
public timeoutMS = 5000;
public timeoutFactor = 1.5;
public plugins: string[] = ['stryker-*'];
public reporter = [];
public reporters: string[] = ['progress', 'clear-text'];
public coverageAnalysis: 'perTest' | 'all' | 'off' = 'off';
public testRunner: string = 'command';
Expand Down
4 changes: 0 additions & 4 deletions packages/stryker-api/src/core/StrykerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ interface StrykerOptions {
*/
coverageAnalysis: 'perTest' | 'all' | 'off';

/**
* DEPRECATED PROPERTY. Please use the `reporters` property
*/
reporter?: string | string[];
/**
* The names of the reporters to use
* Possible values: 'clear-text', 'progress'.
Expand Down
9 changes: 0 additions & 9 deletions packages/stryker/src/config/ConfigReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ export default class ConfigReader {
// merge the config from config file and cliOptions (precedence)
config.set(this.cliOptions);

if (config.reporter.length) {
if (Array.isArray(config.reporter)) {
config.reporters = config.reporter;
} else {
config.reporters = [config.reporter];
}
this.log.warn(`DEPRECATED: please change the config setting 'reporter: ${JSON.stringify(config.reporter)}' into 'reporters: ${JSON.stringify(config.reporters)}'`);
}

return config;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/stryker/src/initializer/presets/VueJsPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class VueJsPreset implements Preset {
jest: {
// config: require('path/to/your/custom/jestConfig.js')
},
reporter: ['progress', 'clear-text', 'html'],
reporters: ['progress', 'clear-text', 'html'],
coverageAnalysis: 'off'
}`;

Expand All @@ -39,7 +39,7 @@ export class VueJsPreset implements Preset {
browsers: ['ChromeHeadless']
}
},
reporter: ['progress', 'clear-text', 'html'],
reporters: ['progress', 'clear-text', 'html'],
coverageAnalysis: 'off'
}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,5 @@ describe(ConfigReader.name, () => {
expect(() => sut.readConfig()).throws('Invalid config file. Inner error: SyntaxError: Unexpected identifier');
});
});

describe('with deprecated reporter property', () => {
it('should log a warning when a single reporter is specified', () => {
const reporterName = 'html';
sut = createSut({ reporter: reporterName });

const result = sut.readConfig();

expect(result.reporters).to.deep.eq([reporterName]);
expect(testInjector.logger.warn).calledWithExactly(`DEPRECATED: please change the config setting 'reporter: "${reporterName}"' into 'reporters: ["${reporterName}"]'`);
});

it('should log a warning when multiple reporters are specified', () => {
const configuredReporters = ['html', 'progress'];
sut = createSut({ reporter: configuredReporters });

const result = sut.readConfig();

expect(result.reporters).to.deep.eq(configuredReporters);
expect(testInjector.logger.warn).calledWithExactly(`DEPRECATED: please change the config setting 'reporter: ${JSON.stringify(configuredReporters)}' into 'reporters: ${JSON.stringify(configuredReporters)}'`);
});
});
});
});

0 comments on commit 2034a67

Please sign in to comment.