|
|
@@ -58,84 +58,6 @@ describe( 'dev-tasks', () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- describe( 'dev-init', () => {
|
|
|
- const initTask = require( '../tasks/utils/dev-init' );
|
|
|
-
|
|
|
- it( 'task should exist', () => expect( initTask ).to.be.a( 'function' ) );
|
|
|
-
|
|
|
- it( 'performs no action when no ckeditor dependencies are found', () => {
|
|
|
- const packageJSON = {
|
|
|
- dependencies: {
|
|
|
- 'non-ckeditor-plugin': 'other/plugin'
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- initTask( mainRepositoryPath, packageJSON, workspaceRoot, emptyFn, emptyFn );
|
|
|
- expect( spies.getDependencies.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getDependencies.firstCall.args[ 0 ] ).to.equal( packageJSON.dependencies );
|
|
|
- expect( spies.getDirectories.called ).to.equal( false );
|
|
|
- expect( spies.parseRepositoryUrl.called ).to.equal( false );
|
|
|
- expect( spies.cloneRepository.called ).to.equal( false );
|
|
|
- expect( spies.checkout.called ).to.equal( false );
|
|
|
- expect( spies.pull.called ).to.equal( false );
|
|
|
- expect( spies.npmInstall.called ).to.equal( false );
|
|
|
- expect( spies.installGitHooks.called ).to.equal( false );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'clones repositories if no directories are found', () => {
|
|
|
- const packageJSON = {
|
|
|
- dependencies: {
|
|
|
- 'ckeditor5-core': 'ckeditor/ckeditor5-core',
|
|
|
- 'ckeditor5-plugin-devtest': 'ckeditor/ckeditor5-plugin-devtest',
|
|
|
- 'non-ckeditor-plugin': 'other/plugin'
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- initTask( mainRepositoryPath, packageJSON, workspaceRoot, emptyFn, emptyFn );
|
|
|
- expect( spies.getDependencies.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getDependencies.firstCall.args[ 0 ] ).to.equal( packageJSON.dependencies );
|
|
|
- expect( spies.getDirectories.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getDirectories.firstCall.args[ 0 ] ).to.equal( path.join( mainRepositoryPath, workspaceRoot ) );
|
|
|
- expect( spies.parseRepositoryUrl.calledTwice ).to.equal( true );
|
|
|
- expect( spies.cloneRepository.calledTwice ).to.equal( true );
|
|
|
- expect( spies.cloneRepository.firstCall.args[ 0 ] ).to.equal( spies.parseRepositoryUrl.firstCall.returnValue );
|
|
|
- expect( spies.cloneRepository.firstCall.args[ 1 ] ).to.equal( workspacePath );
|
|
|
- expect( spies.cloneRepository.secondCall.args[ 0 ] ).to.equal( spies.parseRepositoryUrl.secondCall.returnValue );
|
|
|
- expect( spies.cloneRepository.secondCall.args[ 1 ] ).to.equal( workspacePath );
|
|
|
- expect( spies.checkout.calledTwice ).to.equal( true );
|
|
|
- expect( spies.pull.calledTwice ).to.equal( true );
|
|
|
- expect( spies.linkDirectories.calledTwice ).to.equal( true );
|
|
|
- expect( spies.npmInstall.calledTwice ).to.equal( true );
|
|
|
- expect( spies.installGitHooks.calledTwice ).to.equal( true );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'only checks out repositories if directories are found', () => {
|
|
|
- const packageJSON = {
|
|
|
- dependencies: {
|
|
|
- 'ckeditor5-core': 'ckeditor/ckeditor5-core',
|
|
|
- 'ckeditor5-plugin-devtest': 'ckeditor/ckeditor5-plugin-devtest',
|
|
|
- 'non-ckeditor-plugin': 'other/plugin'
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- spies.getDirectories.restore();
|
|
|
- spies.getDirectories = sinon.stub( tools, 'getCKE5Directories', () => [ 'ckeditor5-core', 'ckeditor5-plugin-devtest' ] );
|
|
|
-
|
|
|
- initTask( mainRepositoryPath, packageJSON, workspaceRoot, emptyFn, emptyFn );
|
|
|
- expect( spies.getDependencies.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getDependencies.firstCall.args[ 0 ] ).to.equal( packageJSON.dependencies );
|
|
|
- expect( spies.getDirectories.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getDirectories.firstCall.args[ 0 ] ).to.equal( path.join( mainRepositoryPath, workspaceRoot ) );
|
|
|
- expect( spies.parseRepositoryUrl.calledTwice ).to.equal( true );
|
|
|
- expect( spies.cloneRepository.called ).to.equal( false );
|
|
|
- expect( spies.checkout.calledTwice ).to.equal( true );
|
|
|
- expect( spies.pull.calledTwice ).to.equal( true );
|
|
|
- expect( spies.linkDirectories.calledTwice ).to.equal( true );
|
|
|
- expect( spies.npmInstall.calledTwice ).to.equal( true );
|
|
|
- expect( spies.installGitHooks.calledTwice ).to.equal( true );
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
describe( 'dev-plugin-create', () => {
|
|
|
const pluginCreateTask = require( '../tasks/utils/dev-plugin-create' );
|
|
|
const repositoryPath = path.join( workspacePath, pluginName );
|