8
0
Просмотр исходного кода

Updated tests for dev-install task.

Szymon Kupś 10 лет назад
Родитель
Сommit
aada6a9cf2
2 измененных файлов с 9 добавлено и 1 удалено
  1. 2 1
      dev/tasks/utils/dev-install.js
  2. 7 0
      dev/tests/dev-install.js

+ 2 - 1
dev/tasks/utils/dev-install.js

@@ -22,6 +22,7 @@ const path = require( 'path' );
  * 5. If plugin exists in `ckeditor5/node_modules/` - runs `npm uninstall plugin_name`.
  * 6. Links plugin directory into `ckeditor5/node_modules/`.
  * 7. Adds dependency to `ckeditor5/package.json`.
+ * 8. Installs Git hooks.
  *
  * @param {String} ckeditor5Path Absolute path to `ckeditor5` repository.
  * @param {String} workspaceRoot Relative path to workspace root directory.
@@ -97,7 +98,7 @@ module.exports = ( ckeditor5Path, workspaceRoot, name, writeln ) => {
 		writeln( `Linking ${ linkPath } to ${ repositoryPath }...` );
 		tools.linkDirectories( repositoryPath, linkPath );
 
-		writeln( `Adding ${ urlInfo.name } dependency to CKEditor5 package.json... ` );
+		writeln( `Adding ${ urlInfo.name } dependency to CKEditor5 package.json...` );
 		tools.updateJSONFile( path.join( ckeditor5Path, 'package.json' ), ( json ) => {
 			json.dependencies = json.dependencies || {};
 			json.dependencies[ urlInfo.name ] = dependency;

+ 7 - 0
dev/tests/dev-install.js

@@ -38,6 +38,7 @@ describe( 'dev-install', () => {
 		spies.getGitUrlFromNpm = sinon.stub( tools, 'getGitUrlFromNpm' );
 		spies.readPackageName = sinon.stub( tools, 'readPackageName' );
 		spies.npmUninstall = sinon.stub( tools, 'npmUninstall' );
+		spies.installGitHooks = sinon.stub( tools, 'installGitHooks' );
 	} );
 
 	afterEach( () => {
@@ -84,6 +85,9 @@ describe( 'dev-install', () => {
 		const json = updateFn( {} );
 		expect( json.dependencies ).to.be.a( 'object' );
 		expect( json.dependencies[ urlInfo.name ] ).to.equal( repositoryUrl );
+
+		sinon.assert.calledOnce( spies.installGitHooks );
+		sinon.assert.calledWithExactly( spies.installGitHooks, repositoryPath );
 	} );
 
 	it( 'should use npm module name', () => {
@@ -124,6 +128,9 @@ describe( 'dev-install', () => {
 		const json = updateFn( {} );
 		expect( json.dependencies ).to.be.a( 'object' );
 		expect( json.dependencies[ urlInfo.name ] ).to.equal( repositoryUrl );
+
+		sinon.assert.calledOnce( spies.installGitHooks );
+		sinon.assert.calledWithExactly( spies.installGitHooks, repositoryPath );
 	} );
 
 	it( 'should use local relative path', () => {