Piotrek Koszuliński преди 9 години
родител
ревизия
47788e2527
променени са 3 файла, в които са добавени 48 реда и са изтрити 15 реда
  1. 2 0
      dev/bender/plugins/ckeditor5/static/extensions.js
  2. 44 14
      gulpfile.js
  3. 2 1
      package.json

+ 2 - 0
dev/bender/plugins/ckeditor5/static/extensions.js

@@ -16,6 +16,8 @@
 
 		if ( moduleId[ 0 ] == '/' ) {
 			url = basePath + url;
+		} else if ( moduleId.startsWith( 'ckeditor5' ) || moduleId.startsWith( 'tests' ) || moduleId.startsWith( 'theme' ) ) {
+			url = basePath + '/' + url;
 		}
 
 		return load( context, moduleId, url );

+ 44 - 14
gulpfile.js

@@ -7,8 +7,10 @@
 
 'use strict';
 
+const path = require( 'path' );
 const gulp = require( 'gulp' );
 const runSequence = require( 'run-sequence' );
+const compiler = require( '@ckeditor/ckeditor5-dev-compiler' );
 
 const config = {
 	ROOT_DIR: '.',
@@ -38,6 +40,11 @@ const config = {
 	]
 };
 
+// Return an array with paths to the CKEditor 5 dependencies.
+function getCKEditor5PackagesPaths() {
+	return compiler.utils.getPackages( config.ROOT_DIR );
+}
+
 // Lint tasks. ---------------------------------------------------------------
 
 const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )( config );
@@ -62,24 +69,17 @@ gulp.task( 'exec', ckeditor5DevEnv.execOnRepositories );
 
 // Compilation tasks. ---------------------------------------------------------
 
-const ckeditor5DevCompiler = require( '@ckeditor/ckeditor5-dev-compiler' );
-
-// Return an array with paths to the CKEditor 5 dependencies.
-function getCKEditor5PackagesPaths() {
-	return ckeditor5DevCompiler.utils.getPackages( config.ROOT_DIR );
-}
-
 gulp.task( 'default', [ 'compile' ] );
 
 gulp.task( 'compile', () => {
-	const args = ckeditor5DevCompiler.utils.parseArguments();
+	const args = compiler.utils.parseArguments();
 	const formats = {};
 
 	for ( const item of args.formats ) {
 		formats[ item ] = config.MODULE_DIR[ item ];
 	}
 
-	return ckeditor5DevCompiler.compiler.compile( {
+	return compiler.tasks.compile( {
 		formats,
 		packages: getCKEditor5PackagesPaths(),
 		watch: args.watch,
@@ -91,29 +91,29 @@ gulp.task( 'compile', () => {
 // Tasks specific for preparing compiled output with unmodified source files. Used by `gulp docs` or `gulp build`.
 // Todo: These tasks should be moved direct to Docs and Bundler.
 gulp.task( 'compile:clean:js:esnext', () => {
-	return ckeditor5DevCompiler.compiler.clean.js( [ config.MODULE_DIR.esnext ] );
+	return compiler.tasks.clean.js( [ config.MODULE_DIR.esnext ] );
 } );
 
 gulp.task( 'compile:clean:themes:esnext', () => {
-	return ckeditor5DevCompiler.compiler.clean.themes( [ config.MODULE_DIR.esnext ] );
+	return compiler.tasks.clean.themes( [ config.MODULE_DIR.esnext ] );
 } );
 
 gulp.task( 'compile:sass:esnext', () => {
-	return ckeditor5DevCompiler.compiler.process.sass( {
+	return compiler.tasks.process.sass( {
 		formats: { esnext: config.MODULE_DIR.esnext },
 		packages: getCKEditor5PackagesPaths()
 	} );
 } );
 
 gulp.task( 'compile:icons:esnext', () => {
-	return ckeditor5DevCompiler.compiler.process.icons( {
+	return compiler.tasks.process.icons( {
 		formats: { esnext: config.MODULE_DIR.esnext },
 		packages: getCKEditor5PackagesPaths()
 	} );
 } );
 
 gulp.task( 'compile:js:esnext', [ 'compile:clean:js:esnext' ], () => {
-	return ckeditor5DevCompiler.compiler.process.js( {
+	return compiler.tasks.process.js( {
 		formats: { esnext: config.MODULE_DIR.esnext },
 		packages: getCKEditor5PackagesPaths()
 	} );
@@ -169,3 +169,33 @@ gulp.task( 'docs:build', docsBuilder.buildDocs );
 gulp.task( 'docs:editors', [ 'compile:js:esnext', 'compile:themes:esnext' ], () => {
 	return docsBuilder.buildEditorsForSamples( getCKEditor5PackagesPaths(), config.DOCUMENTATION.SAMPLES );
 } );
+
+// Tests. ---------------------------------------------------------------------
+
+const tests = require( '@ckeditor/ckeditor5-dev-tests' );
+
+gulp.task( 'test', () => {
+	return tests.tasks.test( getTestOptions() );
+} );
+
+// Requires compiled sources. Task should be used in parallel with `gulp compile --formats=esnext --watch`.
+gulp.task( 'test:server', () => {
+	const options = getTestOptions();
+	options.sourcePath = path.resolve( config.MODULE_DIR.esnext );
+
+	return tests.tasks.runTests( options );
+} );
+
+function getTestOptions() {
+	const options = tests.utils.parseArguments();
+
+	options.packages = getCKEditor5PackagesPaths();
+
+	// If --paths weren't specified, then test all packages.
+	if ( !options.paths ) {
+		options.paths = options.packages
+			.map( ( packagePath ) => tests.utils.getPackageName( path.resolve( packagePath ) ) );
+	}
+
+	return options;
+}

+ 2 - 1
package.json

@@ -30,11 +30,12 @@
   },
   "devDependencies": {
     "@ckeditor/ckeditor5-dev-bundler-rollup": "^2.0.0",
-    "@ckeditor/ckeditor5-dev-compiler": "^3.0.0",
+    "@ckeditor/ckeditor5-dev-compiler": "^4.0.1",
     "@ckeditor/ckeditor5-dev-docs": "^3.0.0",
     "@ckeditor/ckeditor5-dev-env": "^1.0.0",
     "@ckeditor/ckeditor5-dev-lint": "^1.0.1",
     "@ckeditor/ckeditor5-dev-utils": "^1.1.0",
+    "@ckeditor/ckeditor5-dev-tests": "^1.0.0",
     "babel-polyfill": "^6.13.0",
     "benderjs": "^0.4.1",
     "benderjs-chai": "^0.2.0",