Skip to content

Commit

Permalink
Merge pull request #597 from ckeditor/i/481
Browse files Browse the repository at this point in the history
Feature: Add "eslint-plugin-mocha" rules to the default ESLint configuration and configure `dangling-coma` rule. Closes #481. Closes ckeditor/ckeditor5#6246.
  • Loading branch information
pomek authored Feb 25, 2020
2 parents 150fd8e + fd239d9 commit 0bd390a
Show file tree
Hide file tree
Showing 61 changed files with 245 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module.exports = function generateSummaryChangelog( options ) {
dependencies,
newVersion: version,
currentVersion: packageJson.version,
repositoryUrl: packageJson.repository.url.replace( /\.git$/, '' ),
repositoryUrl: packageJson.repository.url.replace( /\.git$/, '' )
} );

// Additional notes for changelog generated from commits should be added if any dependency has been added or changed.
Expand Down Expand Up @@ -368,7 +368,7 @@ module.exports = function generateSummaryChangelog( options ) {
const entries = [
// eslint-disable-next-line max-len
`## [${ options.newVersion }](${ options.repositoryUrl }/compare/v${ options.currentVersion }...v${ options.newVersion }) (${ date })`,
'',
''
];

const allowBreakingChangeInMinor = areBreakingChangesAcceptableInVersion( options.newVersion );
Expand Down
10 changes: 5 additions & 5 deletions packages/ckeditor5-dev-env/lib/release-tools/utils/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const cli = {
message,
type: 'confirm',
name: 'confirm',
default: true,
default: true
};

return inquirer.prompt( [ confirmQuestion ] )
Expand Down Expand Up @@ -95,7 +95,7 @@ const cli = {
message,
type: 'confirm',
name: 'confirm',
default: true,
default: true
};

return inquirer.prompt( [ confirmQuestion ] )
Expand All @@ -112,7 +112,7 @@ const cli = {
message: 'Remove created archives?',
type: 'confirm',
name: 'confirm',
default: true,
default: true
};

return inquirer.prompt( [ confirmQuestion ] )
Expand Down Expand Up @@ -309,12 +309,12 @@ const cli = {
type: 'confirm',
name: 'confirm',
prefix: getPrefix( indentLevel ),
default: haveMajorBreakingChangeCommits,
default: haveMajorBreakingChangeCommits
};

return inquirer.prompt( [ confirmQuestion ] )
.then( answers => answers.confirm );
},
}
};

module.exports = cli;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function getPackagesToRelease( pathsToPackages ) {
if ( gitVersion !== changelogVersion ) {
packagesToRelease.set( repositoryName, {
previousVersion: packageJson.version,
version: changelogVersion,
version: changelogVersion
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const utils = {
key: originalString,
package: packageMatch[ 1 ],
context: contextMatch ? contextMatch[ 1 ] : null,
sentence: sentenceMatch[ 0 ].trim(),
sentence: sentenceMatch[ 0 ].trim()
};
} )
.filter( translationCall => !!translationCall );
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-dev-env/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe( 'dev-env/index', () => {
generateChangelogForSubPackages: sandbox.stub(),
generateChangelogForSubRepositories: sandbox.stub(),
generateSummaryChangelog: sandbox.stub(),
bumpVersions: sandbox.stub(),
bumpVersions: sandbox.stub()
}
};

Expand Down Expand Up @@ -182,7 +182,7 @@ describe( 'dev-env/index', () => {
return tasks.uploadTranslations().then( () => {
sinon.assert.calledOnce( stubs.translations.upload );
sinon.assert.alwaysCalledWithExactly( stubs.translations.upload, {
token: 'token',
token: 'token'
} );
} );
} );
Expand All @@ -195,7 +195,7 @@ describe( 'dev-env/index', () => {
return tasks.downloadTranslations().then( () => {
sinon.assert.calledOnce( stubs.translations.download );
sinon.assert.alwaysCalledWithExactly( stubs.translations.download, {
token: 'token',
token: 'token'
} );
} );
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe( 'dev-env/release-tools/tasks', () => {

stubs = {
changelogUtils: {
changelogFile: changelogUtils.changelogFile,
changelogFile: changelogUtils.changelogFile
},
getNewReleaseType: sandbox.stub(),
displayCommits: sandbox.stub(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe( 'dev-env/release-tools/tasks', () => {
generateChangelogFromCommits: sandbox.stub(),
getPackageJson: sandbox.stub(),
changelogUtils: {
changelogFile: 'CHANGELOG.md',
changelogFile: 'CHANGELOG.md'
},
getNewReleaseType: sandbox.stub(),
displayCommits: sandbox.stub(),
Expand Down Expand Up @@ -200,7 +200,7 @@ describe( 'dev-env/release-tools/tasks', () => {
'/ckeditor5-dev/packages/ckeditor5-dev-bar'
] ),
matched: new Set( [
'/ckeditor5-dev/packages/ckeditor5-dev-foo',
'/ckeditor5-dev/packages/ckeditor5-dev-foo'
] )
} );

Expand Down Expand Up @@ -252,7 +252,7 @@ describe( 'dev-env/release-tools/tasks', () => {
stubs.getSubPackagesPaths.returns( {
skipped: new Set(),
matched: new Set( [
'/ckeditor5-dev/packages/ckeditor5-dev-foo',
'/ckeditor5-dev/packages/ckeditor5-dev-foo'
] )
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ describe( 'dev-env/release-tools/tasks', () => {
},
versionUtils: {
getLastFromChangelog: sandbox.stub(),
getCurrent: sandbox.stub(),
getCurrent: sandbox.stub()
},
cliUtils: {
provideVersion: sandbox.stub(),
provideVersion: sandbox.stub()
},
changelogUtils: {
getChangelog: sandbox.stub(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe( 'dev-env/release-tools/changelog/templates', () => {
};
templateOptions = {
data: {
root: rootOptions,
root: rootOptions
}
};
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe( 'dev-env/release-tools/utils', () => {

const packages = new Set( [
'/packages/ckeditor5-core',
'/packages/ckeditor5-engine',
'/packages/ckeditor5-engine'
] );

return executeOnPackages( packages, functionToExecute )
Expand All @@ -63,7 +63,7 @@ describe( 'dev-env/release-tools/utils', () => {

const packages = new Set( [
'/packages/ckeditor5-core',
'/packages/ckeditor5-engine',
'/packages/ckeditor5-engine'
] );

return executeOnPackages( packages, functionToExecute )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe( 'dev-env/release-tools/utils', () => {
info: sandbox.stub(),
warning: sandbox.stub(),
error: sandbox.stub()
},
}
};

generateChangelogFromCommits = proxyquire( '../../../lib/release-tools/utils/generatechangelogfromcommits', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe( 'dev-env/release-tools/utils', () => {
info: sandbox.stub(),
warning: sandbox.stub(),
error: sandbox.stub()
},
}
};

getPackagesToRelease = proxyquire( '../../../lib/release-tools/utils/getpackagestorelease', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe( 'dev-env/release-tools/utils', () => {
getDirectoriesStub.returns( [
'ckeditor5-core',
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-utils'
] );

const options = {
Expand Down Expand Up @@ -125,7 +125,7 @@ describe( 'dev-env/release-tools/utils', () => {
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-build-classic',
'ckeditor5-build-inline',
'ckeditor5-build-inline'
] );

const options = {
Expand Down Expand Up @@ -161,7 +161,7 @@ describe( 'dev-env/release-tools/utils', () => {
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-build-classic',
'ckeditor5-build-inline',
'ckeditor5-build-inline'
] );

const options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe( 'dev-env/release-tools/utils', () => {
dependencies: {
'@ckeditor/ckeditor5-core': 'ckeditor/ckeditor5-core',
'@ckeditor/ckeditor5-engine': 'ckeditor/ckeditor5-engine',
'@ckeditor/ckeditor5-utils': 'ckeditor/ckeditor5-utils',
'@ckeditor/ckeditor5-utils': 'ckeditor/ckeditor5-utils'
}
} );
getPackageJsonStub.onCall( 1 ).returns( { name: '@ckeditor/ckeditor5-core' } );
Expand Down Expand Up @@ -162,7 +162,7 @@ describe( 'dev-env/release-tools/utils', () => {
dependencies: {
'@ckeditor/ckeditor5-core': 'ckeditor/ckeditor5-core',
'@ckeditor/ckeditor5-engine': 'ckeditor/ckeditor5-engine',
'@ckeditor/ckeditor5-utils': 'ckeditor/ckeditor5-utils',
'@ckeditor/ckeditor5-utils': 'ckeditor/ckeditor5-utils'
}
} );
getPackageJsonStub.onCall( 1 ).returns( { name: '@ckeditor/ckeditor5-core' } );
Expand All @@ -186,7 +186,7 @@ describe( 'dev-env/release-tools/utils', () => {
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-build-classic',
'ckeditor5-build-inline',
'ckeditor5-build-inline'
] );

const options = {
Expand Down Expand Up @@ -234,7 +234,7 @@ describe( 'dev-env/release-tools/utils', () => {
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-build-classic',
'ckeditor5-build-inline',
'ckeditor5-build-inline'
] );

const options = {
Expand Down Expand Up @@ -284,7 +284,7 @@ describe( 'dev-env/release-tools/utils', () => {
'ckeditor5-engine',
'ckeditor5-utils',
'ckeditor5-build-classic',
'ckeditor5-build-inline',
'ckeditor5-build-inline'
] );

const options = {
Expand Down Expand Up @@ -330,7 +330,7 @@ describe( 'dev-env/release-tools/utils', () => {
it( 'allows returning the main repository only (skipMainRepository=false)', () => {
const options = {
cwd: '/tmp',
packages: null,
packages: null
};

const pathsCollection = getSubRepositoriesPaths( options );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {
exec( 'git config user.email "ckeditor5@ckeditor.com"' );
exec( 'git config user.name "CKEditor5 CI"' );
}

getChangedFilesForCommit = require( '../../../../lib/release-tools/utils/transform-commit/getchangedfilesforcommit' );
} );

afterEach( () => {
exec( `rm -rf ${ path.join( tmpCwd, '.git' ) }` );
exec( `rm -rf ${ path.join( tmpCwd, '*' ) }` );
} );

beforeEach( () => {
getChangedFilesForCommit = require( '../../../../lib/release-tools/utils/transform-commit/getchangedfilesforcommit' );
} );

it( 'returns files for initial commit', () => {
exec( 'touch 1.txt' );
exec( 'touch 2.txt' );
Expand All @@ -61,7 +59,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {
'2.txt',
'3.txt',
'4.txt',
'5.txt',
'5.txt'
] );
} );

Expand All @@ -85,7 +83,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {
expect( files ).to.deep.equal( [
'2.js',
'3.js',
'4.js',
'4.js'
] );
} );

Expand Down Expand Up @@ -114,7 +112,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {

expect( files ).to.deep.equal( [
'5.json',
'6.json',
'6.json'
] );
} );

Expand Down Expand Up @@ -153,7 +151,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {

expect( files ).to.deep.equal( [
'5.json',
'6.json',
'6.json'
] );
} );
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {

stubs.getChangedFilesForCommit.returns( [
'packages/ckeditor5-dev-env/README.md',
'packages/ckeditor5-dev-env/package.json',
'packages/ckeditor5-dev-env/package.json'
] );

stubs.transformCommitForSubRepositoryFactory.reset();
Expand Down Expand Up @@ -210,7 +210,7 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {

stubs.getChangedFilesForCommit.returns( [
'packages/ckeditor5-dev-env/README.md',
'packages/ckeditor5-dev-env/package.json',
'packages/ckeditor5-dev-env/package.json'
] );

const commit = transformCommitForSubPackage( rawCommit, context );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ describe( 'dev-env/release-tools/utils/transform-commit', () => {
it( 'attaches additional commit description with correct indent', () => {
const commitDescription = [
'* Release task - rebuilt module for collecting dependencies to release.',
'* Used `semver` package for bumping the version (instead of a custom module).',
'* Used `semver` package for bumping the version (instead of a custom module).'
];

const commitDescriptionWithIndents = [
' * Release task - rebuilt module for collecting dependencies to release.',
' * Used `semver` package for bumping the version (instead of a custom module).',
' * Used `semver` package for bumping the version (instead of a custom module).'
].join( '\n' );

const rawCommit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe( 'dev-env/release-tools/utils', () => {
let json = {
dependencies: {
'package-deps-a': '^1.0.0',
'package-deps-b': '^1.0.0',
'package-deps-b': '^1.0.0'
},
devDependencies: {
'package-dev-a': '^2.0.0'
Expand Down
Loading

0 comments on commit 0bd390a

Please sign in to comment.