Skip to content

Commit

Permalink
feat(mocha): deprecate mocha version 5 and below (#1529)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the use of mocha version 5 and below is deprecated. Please upgrade to mocha 6 or above. See [their changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#600--2019-02-18) for more information about upgrading.
  • Loading branch information
simondel authored and nicojs committed May 2, 2019
1 parent 2b55933 commit 1c55350
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mocha-runner/src/MochaOptionsLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class MochaOptionsLoader {
this.log.debug('Mocha >= 6 detected. Using mocha\'s `%s` to load mocha options', LibWrapper.loadOptions.name);
return this.loadMocha6Options(overrides);
} else {
this.log.warn('DEPRECATED: Mocha < 6 detected. Please upgrade to at least Mocha version 6.');
this.log.debug('Mocha < 6 detected. Using custom logic to parse mocha options');
return this.loadLegacyMochaOptsFile(overrides.opts);
}
Expand Down
6 changes: 6 additions & 0 deletions packages/mocha-runner/test/unit/MochaOptionsLoader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ describe(MochaOptionsLoader.name, () => {
expect(testInjector.logger.debug).calledWith('Mocha < 6 detected. Using custom logic to parse mocha options');
});

it('should log deprecated mocha version warning', async () => {
existsFileStub.returns(false);
sut.load(config);
expect(testInjector.logger.warn).calledWith('DEPRECATED: Mocha < 6 detected. Please upgrade to at least Mocha version 6.');
});

it('should load a mocha.opts file if specified', () => {
readFileStub.returns('');
config.mochaOptions = {
Expand Down

0 comments on commit 1c55350

Please sign in to comment.