From 389458afc2e0fc9aea8c2994c16045a1f61426b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Tue, 1 Jun 2021 14:46:36 +0200 Subject: [PATCH 01/52] Get correct versions to test. --- .gitignore | 1 + package-lock.json | 30 ++++- package.json | 10 +- scripts/angular-tester.js | 264 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 303 insertions(+), 2 deletions(-) create mode 100644 scripts/angular-tester.js diff --git a/.gitignore b/.gitignore index 83c9dc67..0d2fa72d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ yarn-error.log testem.log local.log /typings +angular-tests # System Files .DS_Store diff --git a/package-lock.json b/package-lock.json index 8f5781fa..49697b8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2900,6 +2900,16 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -5186,6 +5196,13 @@ "escape-string-regexp": "^1.0.5" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -7774,6 +7791,13 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "dev": true, + "optional": true + }, "nanoid": { "version": "3.1.23", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", @@ -13047,7 +13071,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", diff --git a/package.json b/package.json index 3fd34447..a9944d43 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "build": "ng build", "build-package": "node ./scripts/build-package.js", "test": "node ./scripts/test.js", + "test:angular-tester": "node ./scripts/angular-tester.js", + "test:all": "npm run test:angular-tester -- --angular all", "lint": "ng lint", "e2e": "ng e2e", "bump": "node ./scripts/bump.js", @@ -61,15 +63,21 @@ "karma-jasmine-html-reporter": "^1.7.0", "karma-spec-reporter": "0.0.32", "ng-packagr": "^12.1.2", - "protractor": "~7.0.0", "rxjs": "^7.2.0", "ts-node": "^10.1.0", "tslib": "^2.3.0", + "minimist": "^1.2.5", + "protractor": "~7.0.0", + "semver": "^7.3.5", "tslint": "^6.1.3", "typescript": "^4.3.5", "wait-until-promise": "^1.0.0", "zone.js": "^0.11.4" }, + "peerDependencies": { + "ckeditor4": "^4.16.1", + "@angular/cli": ">=5" + }, "browserslist": [ "> 0.5%", "last 2 versions", diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js new file mode 100644 index 00000000..e78bc8c7 --- /dev/null +++ b/scripts/angular-tester.js @@ -0,0 +1,264 @@ +/* eslint-env node */ + +const { execSync } = require( 'child_process' ); +const { mkdirSync, rmdirSync, copyFileSync } = require( 'fs' ); +const { resolve: resolvePath } = require( 'path' ); +const satisfiesSemver = require( 'semver/functions/satisfies' ); +const semverMajor = require( 'semver/functions/major' ); + +/** + * + * Usage: `node ./scripts/angular-tester.js ` + * + * Commands: + * + * --browser Specifies environment to test. + * ??? Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11', 'SSR'. + * Defaults to: 'Chrome'. + * --angular Specifies Angular version to test. Possible values: 'all', 'current' or specific version. Defaults to: 'current'. + * + */ +const argv = require( 'minimist' )( process.argv.slice( 2 ) ); +const testedBrowser = argv.browser || 'Chrome'; +const angularVersion = argv.angular || 'current'; + +const PACKAGE_PATH = resolvePath( __dirname, '..' ); +const TESTS_PATH = resolvePath( PACKAGE_PATH, 'angular-tests' ); + +const versionsPassed = []; +const versionsFailed = []; +const errorLogs = {}; + +try { + console.log( '--- Ultimate CKEditor 4 - Angular Integration Tester ---' ); + console.log( `Running tests for: ${testedBrowser}` ); + + cleanupTestDir(); + + getVersionsToTest().forEach( version => { + prepareTestDir( version ); + // testVersion( version ); + } ); + + if ( Object.keys( errorLogs ).length === 0 ) { + console.log( '--- Done without errors. Have a nice day! ---' ); + } else { + logResults( errorLogs ); + } +} catch ( error ) { + console.log( error ); + console.log( '--- Unexpected error occured during testing - see the log above. ---' ); + process.exit( 1 ); +} + +/** + * Removes test directory and its content, then re-creates empty test dir and copies init files. + */ +function cleanupTestDir() { + const filesToCopy = [ + 'package.json', + // 'webpack.config.js', + 'karma.conf.js', + 'scripts/test-transpiler.js', + 'src/ckeditor.jsx', + 'tests/browser/ckeditor.jsx', + 'tests/server/ckeditor.jsx', + 'tests/utils/polyfill.js' + ]; + + rmdirSyncRecursive( TESTS_PATH ); + mkdirSync( TESTS_PATH ); + mkdirSync( `${TESTS_PATH}/src` ); + mkdirSync( `${TESTS_PATH}/tests` ); + mkdirSync( `${TESTS_PATH}/scripts` ); + + // copyFiles( filesToCopy, PACKAGE_PATH, TESTS_PATH ); + + // execNpmCommand( 'install --legacy-peer-deps', TESTS_PATH ); +} + +/** + * Removes directory and its children. + * + * @param {string} path dir path + * @returns {undefined} + */ +function rmdirSyncRecursive( path ) { + return rmdirSync( path, { + recursive: true + } ); +} + + +/** + * Gets list of Angular versions to test based on `--angular` argument. + * + * @returns {string[]} list of versions to be tested + */ +function getVersionsToTest() { + switch ( angularVersion ) { + case 'all': + return getAllAngularVersions(); + case 'current': + return [ getCurrentAngularVersion() ]; + default: + return [ angularVersion ]; + } +} + +/** + * Gets list of all @angular/cli versions that can be tested. + * + * @returns {string[]} list of versions to test + */ +function getAllAngularVersions() { + const packageInfo = require( '../package.json' ); + console.log( packageInfo ); + const availableVersions = getVersions(); + const semverRange = getAngularVersion( packageInfo ); + const versionsInRange = getVersionsInRange( semverRange, availableVersions ); + return getLatestPatches( versionsInRange ); +} + +/** + * Gets list of available @angular/cli versions from npm. + * + * @returns {string[]} + */ +function getVersions() { + const commandResult = execNpmCommand( 'view @angular/cli versions --json' ); + const versions = JSON.parse( commandResult ); + + return versions; +} + +/** + * Gets peered version range from `package.json`. + * + * @param {Object} packageInfo contents of `package.json` + * @returns {string} peered version / version range + */ +function getAngularVersion( packageInfo ) { + const peerDependencies = packageInfo.peerDependencies; + const angular = peerDependencies[ '@angular/cli' ]; + + return angular; +} + +/** + * Filters versions based on requested range. + * + * @param {string} range version range + * @param {string[]} versions list of versions + * @returns {string[]} versions in requested range + */ +function getVersionsInRange( range, versions ) { + return versions.filter( version => { + return satisfiesSemver( version, range ); + } ); +} + +/** + * Gets latest patches for each major version. + * + * @param {string[]} versions list of versions + * @returns {string[]} list of latest patches + */ +function getLatestPatches( versions ) { + const latestPatches = versions.reduce( ( acc, version, index, array ) => { + if ( isLatestPatch( index, array ) ) { + acc.push( version ); + } + + return acc; + }, [] ); + + console.log( 'Versions that will be tested (' + latestPatches.length + '):', latestPatches ); + + return latestPatches; +} + +/** + * Checks if version is latest patch of given list of versions. + * + * @param {number} index current index + * @param {string[]} array list of versions + * @returns {boolean} if version is latest patch + */ +function isLatestPatch( index, array ) { + // Skip checking the last array element. + if ( array.length == index + 1 ) { + return true; + } + + if ( semverMajor( array[ index ] ) != semverMajor( array[ index + 1 ] ) ) { + return true; + } else { + return false; + } +} + + +/** + * Gets currently installed version of Angular. + * + * @returns {string} React version + */ +function getCurrentAngularVersion() { + return require( '@angular/cli/package.json' ).version; +} + + +/** + * Prepares test dir by copying required files and installing dependencies. + * + * @param {string} version React version to test + */ +function prepareTestDir( version ) { + console.log( `--- Preparing package environment for React v${ version } ---` ); + + execNpmCommand( + `install react@${ version } react-dom@${ version } --legacy-peer-deps`, + TESTS_PATH + ); +} + + + +/** + * Executes npm command. + * + * @param {string} command command to execute + * @param {string} cwd dir where to execute command + * @returns {string|Buffer} + */ +function execNpmCommand( command, cwd = __dirname ) { + const cmd = `npm ${command}`; + + return execSync( cmd, { + encoding: 'utf-8', + cwd + } ); +} + + + +function logResults( errorLogs ) { + console.log( '---------------------------------------------------------------------------' ); + console.log( '------------------------- Logs of failed versions -------------------------' ); + console.log( '---------------------------------------------------------------------------' ); + console.log(); + + for ( const key in errorLogs ) { + console.log( '--- ' + key + ' ---', errorLogs[ key ] ); + } + + console.log( '--- Some versions failed. See the logs above. ---' ); + console.log( 'Successful tests:' ); + console.log( versionsPassed ); + console.log(); + console.log( 'Failed tests:' ); + console.log( versionsFailed ); + + process.exit( 1 ); +} From 33e08418b24350c2b9f14b9536a6465bf6dd06bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Wed, 2 Jun 2021 15:32:59 +0200 Subject: [PATCH 02/52] Add creating Angular app. --- scripts/angular-tester.js | 79 +++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index e78bc8c7..ccd95bca 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -23,7 +23,7 @@ const testedBrowser = argv.browser || 'Chrome'; const angularVersion = argv.angular || 'current'; const PACKAGE_PATH = resolvePath( __dirname, '..' ); -const TESTS_PATH = resolvePath( PACKAGE_PATH, 'angular-tests' ); +const TESTS_PATH = resolvePath( PACKAGE_PATH, '..', 'angular-tests' ); const versionsPassed = []; const versionsFailed = []; @@ -35,7 +35,11 @@ try { cleanupTestDir(); - getVersionsToTest().forEach( version => { + // getVersionsToTest().forEach( version => { + // prepareTestDir( version ); + // // testVersion( version ); + // } ); + ['6.2.9'].forEach( version => { prepareTestDir( version ); // testVersion( version ); } ); @@ -52,29 +56,11 @@ try { } /** - * Removes test directory and its content, then re-creates empty test dir and copies init files. + * Removes test directory and its content, then re-creates empty test dir. */ function cleanupTestDir() { - const filesToCopy = [ - 'package.json', - // 'webpack.config.js', - 'karma.conf.js', - 'scripts/test-transpiler.js', - 'src/ckeditor.jsx', - 'tests/browser/ckeditor.jsx', - 'tests/server/ckeditor.jsx', - 'tests/utils/polyfill.js' - ]; - rmdirSyncRecursive( TESTS_PATH ); mkdirSync( TESTS_PATH ); - mkdirSync( `${TESTS_PATH}/src` ); - mkdirSync( `${TESTS_PATH}/tests` ); - mkdirSync( `${TESTS_PATH}/scripts` ); - - // copyFiles( filesToCopy, PACKAGE_PATH, TESTS_PATH ); - - // execNpmCommand( 'install --legacy-peer-deps', TESTS_PATH ); } /** @@ -212,15 +198,27 @@ function getCurrentAngularVersion() { /** * Prepares test dir by copying required files and installing dependencies. * - * @param {string} version React version to test + * @param {string} version Angular version to test */ function prepareTestDir( version ) { - console.log( `--- Preparing package environment for React v${ version } ---` ); + console.log( `--- Preparing package environment for Angular v${ version } ---` ); + + // copyFiles( filesToCopy, PACKAGE_PATH, TESTS_PATH ); + + execNpmCommand( + `init -y`, + TESTS_PATH + ) execNpmCommand( - `install react@${ version } react-dom@${ version } --legacy-peer-deps`, + `i @angular/cli@${ version }`, TESTS_PATH ); + + execNpxCommand( + `ng new cke4-angular-tester`, + TESTS_PATH + ) } @@ -241,6 +239,39 @@ function execNpmCommand( command, cwd = __dirname ) { } ); } +/** + * Executes npx command. + * + * @param {string} command command to execute + * @param {string} cwd dir where to execute command + * @returns {string|Buffer} + */ +function execNpxCommand( command, cwd = __dirname ) { + const cmd = `npx ${command}`; + + return execSync( cmd, { + encoding: 'utf-8', + cwd + } ); +} + + +/** + * Copies files from source to dest. + * + * @param {string} files list of files + * @param {string} src source path + * @param {string} dest destination path + */ + function copyFiles( files, src, dest ) { + files.forEach( file => { + const srcPath = resolvePath( src, file ); + const destPath = resolvePath( dest, file ); + + copyFileSync( srcPath, destPath ); + } ); +} + function logResults( errorLogs ) { From 4b92c259f9237793598419a36a7708dd955f584d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Wed, 9 Jun 2021 10:36:51 +0200 Subject: [PATCH 03/52] Set up autotesting env. --- scripts/angular-tester.js | 59 +++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index ccd95bca..ee6a7a76 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -1,7 +1,8 @@ /* eslint-env node */ const { execSync } = require( 'child_process' ); -const { mkdirSync, rmdirSync, copyFileSync } = require( 'fs' ); +const { mkdirSync, rmdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync } = require( 'fs' ); +const { copySync } = require( 'fs-extra' ); const { resolve: resolvePath } = require( 'path' ); const satisfiesSemver = require( 'semver/functions/satisfies' ); const semverMajor = require( 'semver/functions/major' ); @@ -35,14 +36,14 @@ try { cleanupTestDir(); - // getVersionsToTest().forEach( version => { - // prepareTestDir( version ); - // // testVersion( version ); - // } ); - ['6.2.9'].forEach( version => { + getVersionsToTest().forEach( version => { prepareTestDir( version ); // testVersion( version ); } ); + // [ '7.3.10' ].forEach( version => { + // prepareTestDir( version ); + // // testVersion( version ); + // } ); if ( Object.keys( errorLogs ).length === 0 ) { console.log( '--- Done without errors. Have a nice day! ---' ); @@ -188,7 +189,7 @@ function isLatestPatch( index, array ) { /** * Gets currently installed version of Angular. * - * @returns {string} React version + * @returns {string} Angular version */ function getCurrentAngularVersion() { return require( '@angular/cli/package.json' ).version; @@ -201,9 +202,14 @@ function getCurrentAngularVersion() { * @param {string} version Angular version to test */ function prepareTestDir( version ) { - console.log( `--- Preparing package environment for Angular v${ version } ---` ); + console.log( `--- Preparing package environment for Angular v${version} ---` ); - // copyFiles( filesToCopy, PACKAGE_PATH, TESTS_PATH ); + const filesToCopy = [ + 'src/app', + 'src/ckeditor', + 'src/karma.conf.js', + 'src/test.tools.ts' + ]; execNpmCommand( `init -y`, @@ -211,7 +217,7 @@ function prepareTestDir( version ) { ) execNpmCommand( - `i @angular/cli@${ version }`, + `i @angular/cli@${version}`, TESTS_PATH ); @@ -219,6 +225,31 @@ function prepareTestDir( version ) { `ng new cke4-angular-tester`, TESTS_PATH ) + + execNpmCommand( + `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, + resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + ); + + execNpmCommand( + `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter zone.js@0.10.3`, + resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + ); + + unlinkSync( resolvePath(TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts') ); + + copyFiles( filesToCopy, PACKAGE_PATH, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); + + let res = readFileSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/demo-form/demo-form.component.ts' ), { encoding: 'utf-8' } ); + let result = res.replace( /, { static: true }/g, '' ); + + writeFileSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/demo-form/demo-form.component.ts' ), result ); + + execNpxCommand( + `ng test`, + resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + ); + } @@ -257,18 +288,18 @@ function execNpxCommand( command, cwd = __dirname ) { /** - * Copies files from source to dest. + * Copies files and directories from source to dest. * - * @param {string} files list of files + * @param {string} files list of files and dirs * @param {string} src source path * @param {string} dest destination path */ - function copyFiles( files, src, dest ) { +function copyFiles( files, src, dest ) { files.forEach( file => { const srcPath = resolvePath( src, file ); const destPath = resolvePath( dest, file ); - copyFileSync( srcPath, destPath ); + copySync( srcPath, destPath ); } ); } From 258703fdd5b4b001885485b41d665249ba5bbf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Thu, 17 Jun 2021 10:47:36 +0200 Subject: [PATCH 04/52] Introduce 'noRebuild' option (nr). --- scripts/angular-tester.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index ee6a7a76..5fa9a6ce 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -22,6 +22,7 @@ const semverMajor = require( 'semver/functions/major' ); const argv = require( 'minimist' )( process.argv.slice( 2 ) ); const testedBrowser = argv.browser || 'Chrome'; const angularVersion = argv.angular || 'current'; +const noRebuild = argv.nr || false; const PACKAGE_PATH = resolvePath( __dirname, '..' ); const TESTS_PATH = resolvePath( PACKAGE_PATH, '..', 'angular-tests' ); @@ -34,15 +35,21 @@ try { console.log( '--- Ultimate CKEditor 4 - Angular Integration Tester ---' ); console.log( `Running tests for: ${testedBrowser}` ); - cleanupTestDir(); + if ( !noRebuild ) { + cleanupTestDir(); + } getVersionsToTest().forEach( version => { - prepareTestDir( version ); - // testVersion( version ); + if ( !noRebuild ) { + prepareTestDir( version ); + } + testVersion( version ); } ); // [ '7.3.10' ].forEach( version => { - // prepareTestDir( version ); - // // testVersion( version ); + // if ( !noRebuild ) { + // prepareTestDir( version ); + // } + // testVersion( version ); // } ); if ( Object.keys( errorLogs ).length === 0 ) { @@ -100,7 +107,6 @@ function getVersionsToTest() { */ function getAllAngularVersions() { const packageInfo = require( '../package.json' ); - console.log( packageInfo ); const availableVersions = getVersions(); const semverRange = getAngularVersion( packageInfo ); const versionsInRange = getVersionsInRange( semverRange, availableVersions ); From cba84a447e49a6003aa0b07729694c48d8b22663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Thu, 17 Jun 2021 10:48:18 +0200 Subject: [PATCH 05/52] Introduce proper testing and logging. --- scripts/angular-tester.js | 69 ++++++++++----- src/assets/demo-form.component.ts | 47 ++++++++++ src/assets/karma.conf.js | 141 ++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+), 24 deletions(-) create mode 100644 src/assets/demo-form.component.ts create mode 100644 src/assets/karma.conf.js diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 5fa9a6ce..5bd0a7b0 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -210,11 +210,14 @@ function getCurrentAngularVersion() { function prepareTestDir( version ) { console.log( `--- Preparing package environment for Angular v${version} ---` ); + cleanupTestDir(); + const filesToCopy = [ - 'src/app', - 'src/ckeditor', - 'src/karma.conf.js', - 'src/test.tools.ts' + [ 'app', 'app' ], + [ 'ckeditor', 'ckeditor' ], + [ 'test.tools.ts', 'test.tools.ts' ], + [ 'assets/karma.conf.js', 'karma.conf.js' ], + [ 'assets/demo-form.component.ts', 'app/demo-form/demo-form.component.ts' ] ]; execNpmCommand( @@ -237,29 +240,20 @@ function prepareTestDir( version ) { resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); - execNpmCommand( - `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter zone.js@0.10.3`, - resolvePath( TESTS_PATH, 'cke4-angular-tester' ) - ); - - unlinkSync( resolvePath(TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts') ); - - copyFiles( filesToCopy, PACKAGE_PATH, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); - - let res = readFileSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/demo-form/demo-form.component.ts' ), { encoding: 'utf-8' } ); - let result = res.replace( /, { static: true }/g, '' ); - - writeFileSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/demo-form/demo-form.component.ts' ), result ); + if ( [ 6, 7 ].indexOf( semverMajor( version ) ) >= 0 ) { + console.log( 'this Angular version needs update of zone.js' ); + execNpmCommand( + `i zone.js@0.10.3`, + resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + ); + } - execNpxCommand( - `ng test`, - resolvePath( TESTS_PATH, 'cke4-angular-tester' ) - ); + unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); + copyFiles( filesToCopy, resolvePath( PACKAGE_PATH, 'src' ), resolvePath( TESTS_PATH, 'cke4-angular-tester/src' ) ); } - /** * Executes npm command. * @@ -276,6 +270,7 @@ function execNpmCommand( command, cwd = __dirname ) { } ); } + /** * Executes npx command. * @@ -302,14 +297,40 @@ function execNpxCommand( command, cwd = __dirname ) { */ function copyFiles( files, src, dest ) { files.forEach( file => { - const srcPath = resolvePath( src, file ); - const destPath = resolvePath( dest, file ); + const srcPath = resolvePath( src, file[ 0 ] ); + const destPath = resolvePath( dest, file[ 1 ] ); copySync( srcPath, destPath ); } ); } +/** + * Runs tests for requested Angular version and environment (see `--browser` arg). + * + * @param {string} version Angular version to test + */ +function testVersion( version ) { + try { + console.log( `--- Testing Angular v${version} ---` ); + + process.env.REQUESTED_ANGULAR_VERSION = version; + execNpmCommand( + `run test`, + resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + ); + versionsPassed.push( version ); + } catch ( error ) { + console.error(); + console.error( '--- Errors occured during testing version ' + version + '. See the logs at the bottom. ---' ); + console.error(); + + versionsFailed.push( version ); + errorLogs[ version ] = error.stdout; + + // throw error; + } +} function logResults( errorLogs ) { console.log( '---------------------------------------------------------------------------' ); diff --git a/src/assets/demo-form.component.ts b/src/assets/demo-form.component.ts new file mode 100644 index 00000000..e8e47db1 --- /dev/null +++ b/src/assets/demo-form.component.ts @@ -0,0 +1,47 @@ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +import { + Component, + ViewChild, + AfterViewInit +} from '@angular/core'; + +import { NgForm } from '@angular/forms'; + +@Component( { + selector: 'app-demo-form', + templateUrl: './demo-form.component.html', + styleUrls: [ './demo-form.component.css' ] +} ) + +export class DemoFormComponent implements AfterViewInit { + @ViewChild( 'demoForm' ) demoForm?: NgForm; + + public model = { + name: 'John', + surname: 'Doe', + description: '

A really nice fellow.

' + }; + + public formDataPreview?: string; + + ngAfterViewInit() { + this.demoForm!.control.valueChanges + .subscribe( values => this.formDataPreview = JSON.stringify( values ) ); + } + + onSubmit() { + console.log( 'Form submit, model', this.model ); + } + + reset() { + this.demoForm!.reset(); + } + + get description() { + return this.demoForm!.controls.description; + } +} diff --git a/src/assets/karma.conf.js b/src/assets/karma.conf.js new file mode 100644 index 00000000..2b897fc4 --- /dev/null +++ b/src/assets/karma.conf.js @@ -0,0 +1,141 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +let options = process.env.KARMA_OPTIONS; +options = options ? JSON.parse( options ) : {}; + +module.exports = function ( config ) { + config.set( { + basePath: '', + frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], + plugins: getPlugins(), + client: { + clearContext: false, // leave Jasmine Spec Runner output visible in browser + captureConsole: false, + jasmine: { + random: false + } + }, + coverageIstanbulReporter: { + dir: require( 'path' ).join( __dirname, '../coverage' ), + reports: [ 'html', 'lcovonly' ], + fixWebpackSourcePaths: true + }, + reporters: [ 'spec' ], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: getBrowsers(), + singleRun: !options.watch, + + concurrency: 2, + captureTimeout: 60000, + browserDisconnectTimeout: 60000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 60000, + + specReporter: { + suppressPassed: true, + suppressErrorSummary: true, + maxLogLines: 8 + }, + + ...( options.url && { files: [ options.url ] } ), + + customLaunchers: { + BrowserStack_Edge: { + base: 'BrowserStack', + os: 'Windows', + os_version: '10', + browser: 'edge' + }, + BrowserStack_IE11: { + base: 'BrowserStack', + os: 'Windows', + os_version: '10', + browser: 'ie', + browser_version: '11.0' + }, + BrowserStack_Safari: { + base: 'BrowserStack', + os: 'OS X', + os_version: 'Big Sur', + browser: 'safari' + } + }, + + browserStack: { + username: process.env.BROWSER_STACK_USERNAME, + accessKey: process.env.BROWSER_STACK_ACCESS_KEY, + build: getBuildName(), + project: 'ckeditor4' + }, + } ); +}; + +// Formats name of the build for BrowserStack. It merges a repository name and current timestamp. +// If env variable `TRAVIS_REPO_SLUG` is not available, the function returns `undefined`. +// +// @returns {String|undefined} +function getBuildName() { + const repoSlug = process.env.TRAVIS_REPO_SLUG; + + if ( !repoSlug ) { + return; + } + + const repositoryName = repoSlug.split( '/' )[ 1 ].replace( /-/g, '_' ); + const date = new Date().getTime(); + + return `${ repositoryName } ${ date }`; +} + +function getPlugins() { + const plugins = [ + require( 'karma-jasmine' ), + require( 'karma-chrome-launcher' ), + require( 'karma-firefox-launcher' ), + require( '@angular-devkit/build-angular/plugins/karma' ), + require( 'karma-spec-reporter' ) + ]; + + if ( shouldEnableBrowserStack() ) { + plugins.push( + require( 'karma-browserstack-launcher' ) + ); + } + + return plugins; +} + +function getBrowsers() { + if ( shouldEnableBrowserStack() ) { + return [ + 'Chrome', + 'BrowserStack_Safari', + 'Firefox', + 'BrowserStack_Edge', + 'BrowserStack_IE11' + ]; + } + + return [ + 'Chrome', + 'Firefox' + ]; +} + +function shouldEnableBrowserStack() { + if ( !process.env.BROWSER_STACK_USERNAME ) { + return false; + } + + if ( !process.env.BROWSER_STACK_ACCESS_KEY ) { + return false; + } + + // If the repository slugs are different, the pull request comes from the community (forked repository). + // For such builds, BrowserStack will be disabled. Read more: https://github.com/ckeditor/ckeditor5-dev/issues/358. + return ( process.env.TRAVIS_EVENT_TYPE !== 'pull_request' || process.env.TRAVIS_PULL_REQUEST_SLUG === process.env.TRAVIS_REPO_SLUG ); +} From 920d2f9a0d0d9e08c27a33f7e891bc5cad0ad6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Thu, 17 Jun 2021 10:49:04 +0200 Subject: [PATCH 06/52] Remove unnecessary dependencies. --- scripts/angular-tester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 5bd0a7b0..244f9ce4 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -1,7 +1,7 @@ /* eslint-env node */ const { execSync } = require( 'child_process' ); -const { mkdirSync, rmdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync } = require( 'fs' ); +const { mkdirSync, rmdirSync, unlinkSync } = require( 'fs' ); const { copySync } = require( 'fs-extra' ); const { resolve: resolvePath } = require( 'path' ); const satisfiesSemver = require( 'semver/functions/satisfies' ); From 188bb352312f62959e975208bcf436c4bfa8da01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 18 Jun 2021 12:48:23 +0200 Subject: [PATCH 07/52] Adjust copyFiles function to enable adjusting them per Angular version. --- scripts/angular-tester.js | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 244f9ce4..b6f92f4b 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -45,12 +45,13 @@ try { } testVersion( version ); } ); - // [ '7.3.10' ].forEach( version => { - // if ( !noRebuild ) { - // prepareTestDir( version ); - // } - // testVersion( version ); - // } ); + + /* Versions that will be tested (7): [ + '6.2.9', '7.3.10', + '8.3.29', '9.1.15', + '10.2.3', '11.2.14', + '12.0.4' + ] */ if ( Object.keys( errorLogs ).length === 0 ) { console.log( '--- Done without errors. Have a nice day! ---' ); @@ -213,11 +214,12 @@ function prepareTestDir( version ) { cleanupTestDir(); const filesToCopy = [ - [ 'app', 'app' ], - [ 'ckeditor', 'ckeditor' ], - [ 'test.tools.ts', 'test.tools.ts' ], - [ 'assets/karma.conf.js', 'karma.conf.js' ], - [ 'assets/demo-form.component.ts', 'app/demo-form/demo-form.component.ts' ] + { src: 'app', dest: 'app', versions: 'all' }, + { src: 'ckeditor', dest: 'ckeditor', versions: 'all' }, + { src: 'test.tools.ts', dest: 'test.tools.ts', versions: 'all' }, + { src: 'assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 6, 7 ] }, + { src: 'assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8 ] }, + { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; execNpmCommand( @@ -250,7 +252,12 @@ function prepareTestDir( version ) { unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); - copyFiles( filesToCopy, resolvePath( PACKAGE_PATH, 'src' ), resolvePath( TESTS_PATH, 'cke4-angular-tester/src' ) ); + copyFiles( { + files: filesToCopy, + src: resolvePath( PACKAGE_PATH, 'src' ), + dest: resolvePath( TESTS_PATH, 'cke4-angular-tester/src' ), + version: version + } ); } @@ -291,16 +298,20 @@ function execNpxCommand( command, cwd = __dirname ) { /** * Copies files and directories from source to dest. * - * @param {string} files list of files and dirs - * @param {string} src source path - * @param {string} dest destination path + * @param options + * @param {string} options.files list of files and dirs + * @param {string} options.src source path + * @param {string} options.dest destination path + * @param {string} options.version currently tested Angular version */ -function copyFiles( files, src, dest ) { - files.forEach( file => { - const srcPath = resolvePath( src, file[ 0 ] ); - const destPath = resolvePath( dest, file[ 1 ] ); +function copyFiles( options ) { + options.files.forEach( file => { + if ( file.versions === 'all' || file.versions.indexOf( semverMajor( options.version ) ) >= 0 ) { + const srcPath = resolvePath( options.src, file.src ); + const destPath = resolvePath( options.dest, file.dest ); - copySync( srcPath, destPath ); + copySync( srcPath, destPath ); + } } ); } From 539ccb0468cdb0c00bf7a541c9202529634aeb45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 18 Jun 2021 15:44:58 +0200 Subject: [PATCH 08/52] Ensure correct testing of all angular versions. --- scripts/angular-tester.js | 6 ++++-- src/assets/tsconfig.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/assets/tsconfig.json diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index b6f92f4b..53643694 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -51,7 +51,8 @@ try { '8.3.29', '9.1.15', '10.2.3', '11.2.14', '12.0.4' - ] */ + ] + '1.7.4' - not lts */ if ( Object.keys( errorLogs ).length === 0 ) { console.log( '--- Done without errors. Have a nice day! ---' ); @@ -218,7 +219,8 @@ function prepareTestDir( version ) { { src: 'ckeditor', dest: 'ckeditor', versions: 'all' }, { src: 'test.tools.ts', dest: 'test.tools.ts', versions: 'all' }, { src: 'assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 6, 7 ] }, - { src: 'assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8 ] }, + { src: 'assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, + { src: 'assets/tsconfig.json', dest: '../tsconfig.json', versions: [ 12 ] }, { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; diff --git a/src/assets/tsconfig.json b/src/assets/tsconfig.json new file mode 100644 index 00000000..deb9ca6e --- /dev/null +++ b/src/assets/tsconfig.json @@ -0,0 +1,29 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "es2017", + "module": "es2020", + "lib": [ + "es2018", + "dom" + ] + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} From 41877947a80b29e234c03cbd8d14ec6b358bb9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 18 Jun 2021 17:11:21 +0200 Subject: [PATCH 09/52] Improve logging. --- package-lock.json | 935 +++++++++++++++++++++++++++++++++++++- package.json | 1 + scripts/angular-tester.js | 77 ++-- 3 files changed, 967 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49697b8d..50a5cead 100644 --- a/package-lock.json +++ b/package-lock.json @@ -869,6 +869,28 @@ "@babel/helper-validator-identifier": "^7.12.11", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "@babel/parser": { @@ -2673,6 +2695,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -3227,14 +3273,39 @@ "dev": true }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } } }, "chardet": { @@ -3905,6 +3976,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -3964,6 +4059,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "postcss-selector-parser": { @@ -4119,6 +4238,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8708,6 +8851,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8756,6 +8923,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8795,6 +8986,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8833,6 +9048,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8872,6 +9111,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8910,6 +9173,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -8968,6 +9255,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9006,6 +9317,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9050,6 +9385,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "postcss-selector-parser": { @@ -9105,6 +9464,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "postcss-selector-parser": { @@ -9178,6 +9561,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9216,6 +9623,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9253,6 +9684,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9290,6 +9745,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9327,6 +9806,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9364,6 +9867,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9402,6 +9929,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9450,6 +10001,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9489,6 +10064,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9537,6 +10136,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9574,6 +10197,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9713,6 +10360,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9844,6 +10515,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9881,6 +10576,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9919,6 +10638,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -9992,6 +10735,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -10036,6 +10803,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "postcss-selector-parser": { @@ -10104,6 +10895,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -10142,6 +10957,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -10180,6 +11019,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -10926,6 +11789,30 @@ "chalk": "^2.4.2", "source-map": "^0.6.1", "supports-color": "^6.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + } } }, "source-map": { @@ -12029,12 +12916,20 @@ } }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + } } }, "svgo": { @@ -12352,6 +13247,17 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -12367,6 +13273,15 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", diff --git a/package.json b/package.json index a9944d43..3bad9e24 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@types/jasminewd2": "^2.0.10", "@types/node": "^16.3.2", "browserslist": "^4.16.6", + "chalk": "^4.1.1", "classlist.js": "^1.1.20150312", "codelyzer": "^6.0.2", "core-js": "^3.15.2", diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 53643694..aa273243 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -6,6 +6,7 @@ const { copySync } = require( 'fs-extra' ); const { resolve: resolvePath } = require( 'path' ); const satisfiesSemver = require( 'semver/functions/satisfies' ); const semverMajor = require( 'semver/functions/major' ); +const chalk = require( 'chalk' ); /** * @@ -21,7 +22,7 @@ const semverMajor = require( 'semver/functions/major' ); */ const argv = require( 'minimist' )( process.argv.slice( 2 ) ); const testedBrowser = argv.browser || 'Chrome'; -const angularVersion = argv.angular || 'current'; +const testedNgVersions = getVersionsToTest(); const noRebuild = argv.nr || false; const PACKAGE_PATH = resolvePath( __dirname, '..' ); @@ -32,15 +33,17 @@ const versionsFailed = []; const errorLogs = {}; try { - console.log( '--- Ultimate CKEditor 4 - Angular Integration Tester ---' ); - console.log( `Running tests for: ${testedBrowser}` ); + console.log( chalk.green.bold( '----- Ultimate CKEditor4-Angular Integration Tester -----\n' ) ); + console.log( `Running tests for: ${ chalk.cyan( testedBrowser ) }` ); + console.log( `Angular versions to be tested: ${ chalk.cyan( testedNgVersions ) }\n` ); - if ( !noRebuild ) { - cleanupTestDir(); - } + console.log( chalk.bgBlue.bold( '--- Preparing testing directory ---\n' ) ); - getVersionsToTest().forEach( version => { - if ( !noRebuild ) { + testedNgVersions.forEach( version => { + if ( noRebuild ) { + console.log( chalk.yellow( '`no-rebuild` option detected; using existing testing directory.\n' ) ); + } else { + cleanupTestDir(); prepareTestDir( version ); } testVersion( version ); @@ -55,13 +58,13 @@ try { '1.7.4' - not lts */ if ( Object.keys( errorLogs ).length === 0 ) { - console.log( '--- Done without errors. Have a nice day! ---' ); + console.log( chalk.green.bold( '----- Done without errors. Have a nice day! -----' ) ); } else { - logResults( errorLogs ); + logErrors( errorLogs ); } } catch ( error ) { - console.log( error ); - console.log( '--- Unexpected error occured during testing - see the log above. ---' ); + console.log( chalk.red( error ) ); + console.log( chalk.red( '----- Unexpected error occured during testing - see the log above. -----' ) ); process.exit( 1 ); } @@ -69,6 +72,8 @@ try { * Removes test directory and its content, then re-creates empty test dir. */ function cleanupTestDir() { + console.log( chalk.magenta( 'Recreating the testing directory...\n' ) ); + rmdirSyncRecursive( TESTS_PATH ); mkdirSync( TESTS_PATH ); } @@ -92,13 +97,13 @@ function rmdirSyncRecursive( path ) { * @returns {string[]} list of versions to be tested */ function getVersionsToTest() { - switch ( angularVersion ) { + switch ( argv.angular ) { case 'all': return getAllAngularVersions(); - case 'current': + case undefined: return [ getCurrentAngularVersion() ]; default: - return [ angularVersion ]; + return [ argv.angular ]; } } @@ -168,7 +173,7 @@ function getLatestPatches( versions ) { return acc; }, [] ); - console.log( 'Versions that will be tested (' + latestPatches.length + '):', latestPatches ); + console.log( `Versions that will be tested ( ${ chalk.cyan( latestPatches.length ) } ): ${ chalk.cyan( latestPatches ) }` ); return latestPatches; } @@ -210,9 +215,7 @@ function getCurrentAngularVersion() { * @param {string} version Angular version to test */ function prepareTestDir( version ) { - console.log( `--- Preparing package environment for Angular v${version} ---` ); - - cleanupTestDir(); + console.log( chalk.bgBlue.bold( `--- Preparing environment for ${ chalk.italic( '@angular/cli@' + version ) } ---\n` ) ); const filesToCopy = [ { src: 'app', dest: 'app', versions: 'all' }, @@ -224,36 +227,39 @@ function prepareTestDir( version ) { { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; + console.log( chalk.magenta( `Initializing ${ chalk.italic( 'package.json' ) } file...\n` ) ); execNpmCommand( `init -y`, TESTS_PATH ) + console.log( chalk.magenta( `Installing ${ chalk.italic( '@angular/cli' ) } locally...\n` ) ); execNpmCommand( `i @angular/cli@${version}`, TESTS_PATH ); + console.log( chalk.magenta( 'Initializing Angular project...\n' ) ); execNpxCommand( `ng new cke4-angular-tester`, TESTS_PATH ) + console.log( chalk.magenta( 'Installing other required packages...\n' ) ); execNpmCommand( `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); if ( [ 6, 7 ].indexOf( semverMajor( version ) ) >= 0 ) { - console.log( 'this Angular version needs update of zone.js' ); execNpmCommand( `i zone.js@0.10.3`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); } + console.log( chalk.magenta( 'Copying integration and tests files...\n' ) ); unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); - copyFiles( { files: filesToCopy, src: resolvePath( PACKAGE_PATH, 'src' ), @@ -325,9 +331,9 @@ function copyFiles( options ) { */ function testVersion( version ) { try { - console.log( `--- Testing Angular v${version} ---` ); - - process.env.REQUESTED_ANGULAR_VERSION = version; + console.log( chalk.bgBlue.bold( `--- Testing ${ chalk.italic( '@angular/cli@' + version ) } ---\n` ) ); + // process.env.REQUESTED_ANGULAR_VERSION = version; + console.log( chalk.magenta( 'Executing tests...' ) ); execNpmCommand( `run test`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) @@ -335,7 +341,7 @@ function testVersion( version ) { versionsPassed.push( version ); } catch ( error ) { console.error(); - console.error( '--- Errors occured during testing version ' + version + '. See the logs at the bottom. ---' ); + console.error( chalk.yellow( '--- Errors occured during testing version ' + version + '. See the logs at the bottom after testing is finished. ---' ) ); console.error(); versionsFailed.push( version ); @@ -345,22 +351,21 @@ function testVersion( version ) { } } -function logResults( errorLogs ) { - console.log( '---------------------------------------------------------------------------' ); - console.log( '------------------------- Logs of failed versions -------------------------' ); - console.log( '---------------------------------------------------------------------------' ); +function logErrors( errorLogs ) { + console.log( chalk.red( '---------------------------------------------------------------------------' ) ); + console.log( chalk.red( '------------------------- Logs of failed versions -------------------------' ) ); + console.log( chalk.red( '---------------------------------------------------------------------------' ) ); console.log(); for ( const key in errorLogs ) { - console.log( '--- ' + key + ' ---', errorLogs[ key ] ); + console.log( chalk.magenta ( '--- ' + key + ' ---'), chalk.yellow( errorLogs[ key ] ) ); } - console.log( '--- Some versions failed. See the logs above. ---' ); - console.log( 'Successful tests:' ); - console.log( versionsPassed ); - console.log(); - console.log( 'Failed tests:' ); - console.log( versionsFailed ); + console.log( chalk.red( '----- Testing done. Some versions failed. See the logs above. -----\n' ) ); + console.log( 'Successfully tested versions:' ); + console.log( chalk.green( versionsPassed + '\n' ) ); + console.log( 'Unsuccessfully tested versions:' ); + console.log( chalk.red( versionsFailed ) + '\n' ); process.exit( 1 ); } From afd348aaed6cac5a30726f4b03f9235087cdc91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 18 Jun 2021 18:07:27 +0200 Subject: [PATCH 10/52] Enable testing target browser. --- scripts/angular-tester.js | 6 +++++- src/assets/karma.conf.js | 21 +++------------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index aa273243..fb7c3eeb 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -58,13 +58,17 @@ try { '1.7.4' - not lts */ if ( Object.keys( errorLogs ).length === 0 ) { + console.log( chalk.green.bold( '-------------------------------------------------' ) ); console.log( chalk.green.bold( '----- Done without errors. Have a nice day! -----' ) ); + console.log( chalk.green.bold( '-------------------------------------------------' ) ); } else { logErrors( errorLogs ); } } catch ( error ) { console.log( chalk.red( error ) ); + console.log( chalk.red( '------------------------------------------------------------------------' ) ); console.log( chalk.red( '----- Unexpected error occured during testing - see the log above. -----' ) ); + console.log( chalk.red( '------------------------------------------------------------------------' ) ); process.exit( 1 ); } @@ -335,7 +339,7 @@ function testVersion( version ) { // process.env.REQUESTED_ANGULAR_VERSION = version; console.log( chalk.magenta( 'Executing tests...' ) ); execNpmCommand( - `run test`, + `run test -- --browsers ${ testedBrowser }`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); versionsPassed.push( version ); diff --git a/src/assets/karma.conf.js b/src/assets/karma.conf.js index 2b897fc4..a95d7cfd 100644 --- a/src/assets/karma.conf.js +++ b/src/assets/karma.conf.js @@ -5,6 +5,8 @@ let options = process.env.KARMA_OPTIONS; options = options ? JSON.parse( options ) : {}; module.exports = function ( config ) { + const browsers = config.browsers.length === 0 ? [ 'Chrome' ] : config.browsers; + config.set( { basePath: '', frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], @@ -26,7 +28,7 @@ module.exports = function ( config ) { colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: getBrowsers(), + browsers, singleRun: !options.watch, concurrency: 2, @@ -109,23 +111,6 @@ function getPlugins() { return plugins; } -function getBrowsers() { - if ( shouldEnableBrowserStack() ) { - return [ - 'Chrome', - 'BrowserStack_Safari', - 'Firefox', - 'BrowserStack_Edge', - 'BrowserStack_IE11' - ]; - } - - return [ - 'Chrome', - 'Firefox' - ]; -} - function shouldEnableBrowserStack() { if ( !process.env.BROWSER_STACK_USERNAME ) { return false; From 5e1ad16f309cad01d50f360b145c6c6fe1764799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 11:45:25 +0200 Subject: [PATCH 11/52] Improve logging (before cleanup). --- scripts/angular-tester.js | 126 ++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 33 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index fb7c3eeb..88d65d55 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -32,16 +32,66 @@ const versionsPassed = []; const versionsFailed = []; const errorLogs = {}; -try { - console.log( chalk.green.bold( '----- Ultimate CKEditor4-Angular Integration Tester -----\n' ) ); - console.log( `Running tests for: ${ chalk.cyan( testedBrowser ) }` ); - console.log( `Angular versions to be tested: ${ chalk.cyan( testedNgVersions ) }\n` ); +class Logger { + constructor() {} + + logBanner( type, message ) { + console.log( chalk.bold[ this._getColor( type ) ]( + this._decorateBanner( message ) + '\n' + ) ); + } + + logHeader( message ) { + console.log( chalk.bold.bgBlue( + this._decorateHeader( message ) + '\n' + ) ); + } + + logAction( message ) { + console.log( chalk.magenta( message ) + '\n' ); + } + + logWarning( message ) { + console.log( chalk.yellow( message ) + '\n' ); + } + + logInfo( message ) { + console.log( message ); + } - console.log( chalk.bgBlue.bold( '--- Preparing testing directory ---\n' ) ); + _decorateBanner( message ) { + message = '----- ' + message + ' -----'; + + return '-'.repeat( message.length ) + '\n' + message + '\n' + '-'.repeat( message.length ); + } + + _decorateHeader( message ) { + return '--- ' + message + ' ---'; + } + + _getColor( type ) { + switch ( type ) { + case 'success': + return 'green'; + case 'info': + return 'blue'; + case 'error': + return 'red'; + } + } +} + +const logger = new Logger(); + +try { + logger.logBanner( 'info', 'Ultimate CKEditor4-Angular Integration Tester' ) + logger.logInfo( `Running tests for: ${chalk.cyan( testedBrowser )}` ); + logger.logInfo( `Angular versions to be tested: ${chalk.cyan( testedNgVersions )}\n` ); + logger.logHeader( 'Preparing testing directory' ); testedNgVersions.forEach( version => { if ( noRebuild ) { - console.log( chalk.yellow( '`no-rebuild` option detected; using existing testing directory.\n' ) ); + logger.logWarning( '`no-rebuild` option detected; using existing testing directory.' ); } else { cleanupTestDir(); prepareTestDir( version ); @@ -58,17 +108,17 @@ try { '1.7.4' - not lts */ if ( Object.keys( errorLogs ).length === 0 ) { - console.log( chalk.green.bold( '-------------------------------------------------' ) ); - console.log( chalk.green.bold( '----- Done without errors. Have a nice day! -----' ) ); - console.log( chalk.green.bold( '-------------------------------------------------' ) ); + logger.logHeader( 'success', 'Done without errors. Have a nice day!' ); } else { logErrors( errorLogs ); } } catch ( error ) { - console.log( chalk.red( error ) ); - console.log( chalk.red( '------------------------------------------------------------------------' ) ); - console.log( chalk.red( '----- Unexpected error occured during testing - see the log above. -----' ) ); - console.log( chalk.red( '------------------------------------------------------------------------' ) ); + // console.log( chalk.red( error ) ); + logger.logWarning( error ); + logger.logHeader( 'error', 'Unexpected error occured during testing - see the log above.' ); + // console.log( chalk.red( '------------------------------------------------------------------------' ) ); + // console.log( chalk.red( '----- Unexpected error occured during testing - see the log above. -----' ) ); + // console.log( chalk.red( '------------------------------------------------------------------------' ) ); process.exit( 1 ); } @@ -76,7 +126,8 @@ try { * Removes test directory and its content, then re-creates empty test dir. */ function cleanupTestDir() { - console.log( chalk.magenta( 'Recreating the testing directory...\n' ) ); + // console.log( chalk.magenta( 'Recreating the testing directory...\n' ) ); + logger.logAction( 'Recreating the testing directory...' ); rmdirSyncRecursive( TESTS_PATH ); mkdirSync( TESTS_PATH ); @@ -177,7 +228,7 @@ function getLatestPatches( versions ) { return acc; }, [] ); - console.log( `Versions that will be tested ( ${ chalk.cyan( latestPatches.length ) } ): ${ chalk.cyan( latestPatches ) }` ); + logger.logInfo( `Versions that will be tested ( ${chalk.cyan( latestPatches.length )} ): ${chalk.cyan( latestPatches )}` ); return latestPatches; } @@ -219,7 +270,7 @@ function getCurrentAngularVersion() { * @param {string} version Angular version to test */ function prepareTestDir( version ) { - console.log( chalk.bgBlue.bold( `--- Preparing environment for ${ chalk.italic( '@angular/cli@' + version ) } ---\n` ) ); + logger.logHeader( `Preparing environment for ${chalk.italic( '@angular/cli@' + version )}` ); const filesToCopy = [ { src: 'app', dest: 'app', versions: 'all' }, @@ -231,25 +282,29 @@ function prepareTestDir( version ) { { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; - console.log( chalk.magenta( `Initializing ${ chalk.italic( 'package.json' ) } file...\n` ) ); + console.log( chalk.magenta( `Initializing ${chalk.italic( 'package.json' )} file...\n` ) ); + logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); execNpmCommand( `init -y`, TESTS_PATH ) - console.log( chalk.magenta( `Installing ${ chalk.italic( '@angular/cli' ) } locally...\n` ) ); + console.log( chalk.magenta( `Installing ${chalk.italic( '@angular/cli' )} locally...\n` ) ); + logger.logAction( `Installing ${chalk.italic( '@angular/cli' )} locally...` ); execNpmCommand( `i @angular/cli@${version}`, TESTS_PATH ); console.log( chalk.magenta( 'Initializing Angular project...\n' ) ); + logger.logAction( 'Initializing Angular project...' ); execNpxCommand( `ng new cke4-angular-tester`, TESTS_PATH ) console.log( chalk.magenta( 'Installing other required packages...\n' ) ); + logger.logAction( 'Installing other required packages...' ); execNpmCommand( `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) @@ -263,6 +318,7 @@ function prepareTestDir( version ) { } console.log( chalk.magenta( 'Copying integration and tests files...\n' ) ); + logger.logAction( 'Copying integration and tests files...' ); unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); copyFiles( { files: filesToCopy, @@ -335,18 +391,18 @@ function copyFiles( options ) { */ function testVersion( version ) { try { - console.log( chalk.bgBlue.bold( `--- Testing ${ chalk.italic( '@angular/cli@' + version ) } ---\n` ) ); + console.log( chalk.bgBlue.bold( `--- Testing ${chalk.italic( '@angular/cli@' + version )} ---\n` ) ); + logger.logHeader( `Testing ${chalk.italic( '@angular/cli@' + version )}` ); // process.env.REQUESTED_ANGULAR_VERSION = version; console.log( chalk.magenta( 'Executing tests...' ) ); + logger.logAction( 'Executing tests...' ); execNpmCommand( - `run test -- --browsers ${ testedBrowser }`, + `run test -- --browsers ${testedBrowser}`, resolvePath( TESTS_PATH, 'cke4-angular-tester' ) ); versionsPassed.push( version ); } catch ( error ) { - console.error(); - console.error( chalk.yellow( '--- Errors occured during testing version ' + version + '. See the logs at the bottom after testing is finished. ---' ) ); - console.error(); + logger.logWarning( 'Errors occured during testing version ' + version + '. See the logs at the bottom after testing is finished.' ); versionsFailed.push( version ); errorLogs[ version ] = error.stdout; @@ -356,20 +412,24 @@ function testVersion( version ) { } function logErrors( errorLogs ) { - console.log( chalk.red( '---------------------------------------------------------------------------' ) ); - console.log( chalk.red( '------------------------- Logs of failed versions -------------------------' ) ); - console.log( chalk.red( '---------------------------------------------------------------------------' ) ); - console.log(); + logger.logBanner( 'error', 'Logs of failed versions' ); + // console.log( chalk.red( '---------------------------------------------------------------------------' ) ); + // console.log( chalk.red( '------------------------- Logs of failed versions -------------------------' ) ); + // console.log( chalk.red( '---------------------------------------------------------------------------' ) ); + // console.log(); for ( const key in errorLogs ) { - console.log( chalk.magenta ( '--- ' + key + ' ---'), chalk.yellow( errorLogs[ key ] ) ); + logger.logInfo( key ); + logger.logWarning( errorLogs[ key ] ); + // console.log( chalk.magenta( '--- ' + key + ' ---' ), chalk.yellow( errorLogs[ key ] ) ); } - console.log( chalk.red( '----- Testing done. Some versions failed. See the logs above. -----\n' ) ); - console.log( 'Successfully tested versions:' ); - console.log( chalk.green( versionsPassed + '\n' ) ); - console.log( 'Unsuccessfully tested versions:' ); - console.log( chalk.red( versionsFailed ) + '\n' ); + logger.logBanner( 'error', 'Testing done. Some versions failed. See the logs above.' ); + // console.log( chalk.red( '----- Testing done. Some versions failed. See the logs above. -----\n' ) ); + logger.logInfo( 'Successfully tested versions:' ); + logger.logInfo( chalk.green( versionsPassed + '\n' ) ); + logger.logInfo( 'Unsuccessfully tested versions:' ); + logger.logInfo( chalk.red( versionsFailed ) + '\n' ); process.exit( 1 ); } From 7d1211a788e9edad3716c1a4a4cd58eeab737055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 11:47:19 +0200 Subject: [PATCH 12/52] Improve logging (after cleanup). --- scripts/angular-tester.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 88d65d55..79fae2a7 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -113,12 +113,9 @@ try { logErrors( errorLogs ); } } catch ( error ) { - // console.log( chalk.red( error ) ); logger.logWarning( error ); logger.logHeader( 'error', 'Unexpected error occured during testing - see the log above.' ); - // console.log( chalk.red( '------------------------------------------------------------------------' ) ); - // console.log( chalk.red( '----- Unexpected error occured during testing - see the log above. -----' ) ); - // console.log( chalk.red( '------------------------------------------------------------------------' ) ); + process.exit( 1 ); } @@ -126,7 +123,6 @@ try { * Removes test directory and its content, then re-creates empty test dir. */ function cleanupTestDir() { - // console.log( chalk.magenta( 'Recreating the testing directory...\n' ) ); logger.logAction( 'Recreating the testing directory...' ); rmdirSyncRecursive( TESTS_PATH ); @@ -282,28 +278,24 @@ function prepareTestDir( version ) { { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; - console.log( chalk.magenta( `Initializing ${chalk.italic( 'package.json' )} file...\n` ) ); logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); execNpmCommand( `init -y`, TESTS_PATH ) - console.log( chalk.magenta( `Installing ${chalk.italic( '@angular/cli' )} locally...\n` ) ); logger.logAction( `Installing ${chalk.italic( '@angular/cli' )} locally...` ); execNpmCommand( `i @angular/cli@${version}`, TESTS_PATH ); - console.log( chalk.magenta( 'Initializing Angular project...\n' ) ); logger.logAction( 'Initializing Angular project...' ); execNpxCommand( `ng new cke4-angular-tester`, TESTS_PATH ) - console.log( chalk.magenta( 'Installing other required packages...\n' ) ); logger.logAction( 'Installing other required packages...' ); execNpmCommand( `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, @@ -317,7 +309,6 @@ function prepareTestDir( version ) { ); } - console.log( chalk.magenta( 'Copying integration and tests files...\n' ) ); logger.logAction( 'Copying integration and tests files...' ); unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); copyFiles( { @@ -391,10 +382,8 @@ function copyFiles( options ) { */ function testVersion( version ) { try { - console.log( chalk.bgBlue.bold( `--- Testing ${chalk.italic( '@angular/cli@' + version )} ---\n` ) ); logger.logHeader( `Testing ${chalk.italic( '@angular/cli@' + version )}` ); // process.env.REQUESTED_ANGULAR_VERSION = version; - console.log( chalk.magenta( 'Executing tests...' ) ); logger.logAction( 'Executing tests...' ); execNpmCommand( `run test -- --browsers ${testedBrowser}`, @@ -413,19 +402,13 @@ function testVersion( version ) { function logErrors( errorLogs ) { logger.logBanner( 'error', 'Logs of failed versions' ); - // console.log( chalk.red( '---------------------------------------------------------------------------' ) ); - // console.log( chalk.red( '------------------------- Logs of failed versions -------------------------' ) ); - // console.log( chalk.red( '---------------------------------------------------------------------------' ) ); - // console.log(); for ( const key in errorLogs ) { logger.logInfo( key ); logger.logWarning( errorLogs[ key ] ); - // console.log( chalk.magenta( '--- ' + key + ' ---' ), chalk.yellow( errorLogs[ key ] ) ); } logger.logBanner( 'error', 'Testing done. Some versions failed. See the logs above.' ); - // console.log( chalk.red( '----- Testing done. Some versions failed. See the logs above. -----\n' ) ); logger.logInfo( 'Successfully tested versions:' ); logger.logInfo( chalk.green( versionsPassed + '\n' ) ); logger.logInfo( 'Unsuccessfully tested versions:' ); From d4a5a87afa9455eff3a97b3519dbb06c133a843f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 12:14:48 +0200 Subject: [PATCH 13/52] Extract Logger class. --- scripts/angular-tester.js | 52 ++------------------------------------- scripts/logger.js | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 50 deletions(-) create mode 100644 scripts/logger.js diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 79fae2a7..792d3eed 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -7,6 +7,7 @@ const { resolve: resolvePath } = require( 'path' ); const satisfiesSemver = require( 'semver/functions/satisfies' ); const semverMajor = require( 'semver/functions/major' ); const chalk = require( 'chalk' ); +const Logger = require( './logger' ); /** * @@ -15,7 +16,7 @@ const chalk = require( 'chalk' ); * Commands: * * --browser Specifies environment to test. - * ??? Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11', 'SSR'. + * ??? Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11'. * Defaults to: 'Chrome'. * --angular Specifies Angular version to test. Possible values: 'all', 'current' or specific version. Defaults to: 'current'. * @@ -32,55 +33,6 @@ const versionsPassed = []; const versionsFailed = []; const errorLogs = {}; -class Logger { - constructor() {} - - logBanner( type, message ) { - console.log( chalk.bold[ this._getColor( type ) ]( - this._decorateBanner( message ) + '\n' - ) ); - } - - logHeader( message ) { - console.log( chalk.bold.bgBlue( - this._decorateHeader( message ) + '\n' - ) ); - } - - logAction( message ) { - console.log( chalk.magenta( message ) + '\n' ); - } - - logWarning( message ) { - console.log( chalk.yellow( message ) + '\n' ); - } - - logInfo( message ) { - console.log( message ); - } - - _decorateBanner( message ) { - message = '----- ' + message + ' -----'; - - return '-'.repeat( message.length ) + '\n' + message + '\n' + '-'.repeat( message.length ); - } - - _decorateHeader( message ) { - return '--- ' + message + ' ---'; - } - - _getColor( type ) { - switch ( type ) { - case 'success': - return 'green'; - case 'info': - return 'blue'; - case 'error': - return 'red'; - } - } -} - const logger = new Logger(); try { diff --git a/scripts/logger.js b/scripts/logger.js new file mode 100644 index 00000000..c33dcac8 --- /dev/null +++ b/scripts/logger.js @@ -0,0 +1,50 @@ +const chalk = require( 'chalk' ); + +module.exports = class Logger { + constructor() {} + + logBanner( type, message ) { + console.log( chalk.bold[ this._getColor( type ) ]( + this._decorateBanner( message ) + '\n' + ) ); + } + + logHeader( message ) { + console.log( chalk.bold.bgBlue( + this._decorateHeader( message ) + '\n' + ) ); + } + + logAction( message ) { + console.log( chalk.magenta( message ) + '\n' ); + } + + logWarning( message ) { + console.log( chalk.yellow( message ) + '\n' ); + } + + logInfo( message ) { + console.log( message ); + } + + _decorateBanner( message ) { + message = '----- ' + message + ' -----'; + + return '-'.repeat( message.length ) + '\n' + message + '\n' + '-'.repeat( message.length ); + } + + _decorateHeader( message ) { + return '--- ' + message + ' ---'; + } + + _getColor( type ) { + switch ( type ) { + case 'success': + return 'green'; + case 'info': + return 'blue'; + case 'error': + return 'red'; + } + } +} From e81148fd7d262ab234cdc88c39218caba805b509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 12:40:34 +0200 Subject: [PATCH 14/52] Extract some more logic. --- scripts/_helpers/getVersions.js | 124 +++++++++++++++++++ scripts/{ => _helpers}/logger.js | 0 scripts/_helpers/tools.js | 77 ++++++++++++ scripts/angular-tester.js | 197 +------------------------------ 4 files changed, 207 insertions(+), 191 deletions(-) create mode 100644 scripts/_helpers/getVersions.js rename scripts/{ => _helpers}/logger.js (100%) create mode 100644 scripts/_helpers/tools.js diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js new file mode 100644 index 00000000..f29ba7e0 --- /dev/null +++ b/scripts/_helpers/getVersions.js @@ -0,0 +1,124 @@ +const satisfiesSemver = require( 'semver/functions/satisfies' ); +const semverMajor = require( 'semver/functions/major' ); +const { execNpmCommand } = require( './tools' ); + +/** + * Gets list of Angular versions to test based on `--angular` argument. + * + * @param {string} command + * @returns {string[]} list of versions to be tested + */ +function getVersions( command ) { + switch ( command ) { + case 'all': + return getAllAngularVersions(); + case undefined: + return [ getCurrentAngularVersion() ]; + default: + return [ command ]; + } +} + +/** + * Gets list of all @angular/cli versions that can be tested. + * + * @returns {string[]} list of versions to test + */ +function getAllAngularVersions() { + const packageInfo = require( '../../package.json' ); + const availableVersions = getNpmVersions(); + const semverRange = getAngularVersion( packageInfo ); + const versionsInRange = getVersionsInRange( semverRange, availableVersions ); + return getLatestPatches( versionsInRange ); +} + +/** + * Gets list of available @angular/cli versions from npm. + * + * @returns {string[]} + */ +function getNpmVersions() { + const commandResult = execNpmCommand( 'view @angular/cli versions --json' ); + const versions = JSON.parse( commandResult ); + + return versions; +} + +/** + * Gets peered version range from `package.json`. + * + * @param {Object} packageInfo contents of `package.json` + * @returns {string} peered version / version range + */ +function getAngularVersion( packageInfo ) { + const peerDependencies = packageInfo.peerDependencies; + const angular = peerDependencies[ '@angular/cli' ]; + + return angular; +} + +/** + * Filters versions based on requested range. + * + * @param {string} range version range + * @param {string[]} versions list of versions + * @returns {string[]} versions in requested range + */ +function getVersionsInRange( range, versions ) { + return versions.filter( version => { + return satisfiesSemver( version, range ); + } ); +} + +/** + * Gets latest patches for each major version. + * + * @param {string[]} versions list of versions + * @returns {string[]} list of latest patches + */ +function getLatestPatches( versions ) { + const latestPatches = versions.reduce( ( acc, version, index, array ) => { + if ( isLatestPatch( index, array ) ) { + acc.push( version ); + } + + return acc; + }, [] ); + + // @todo + // logger.logInfo( `Versions that will be tested ( ${chalk.cyan( latestPatches.length )} ): ${chalk.cyan( latestPatches )}` ); + + return latestPatches; +} + +/** + * Checks if version is latest patch of given list of versions. + * + * @param {number} index current index + * @param {string[]} array list of versions + * @returns {boolean} if version is latest patch + */ +function isLatestPatch( index, array ) { + // Skip checking the last array element. + if ( array.length == index + 1 ) { + return true; + } + + if ( semverMajor( array[ index ] ) != semverMajor( array[ index + 1 ] ) ) { + return true; + } else { + return false; + } +} + + +/** + * Gets currently installed version of Angular. + * + * @returns {string} Angular version + */ +function getCurrentAngularVersion() { + return require( '@angular/cli/package.json' ).version; +} + +module.exports = getVersions; diff --git a/scripts/logger.js b/scripts/_helpers/logger.js similarity index 100% rename from scripts/logger.js rename to scripts/_helpers/logger.js diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js new file mode 100644 index 00000000..cedeaede --- /dev/null +++ b/scripts/_helpers/tools.js @@ -0,0 +1,77 @@ +const { execSync } = require( 'child_process' ); +const { rmdirSync } = require( 'fs' ); +const { copySync } = require( 'fs-extra' ); +const semverMajor = require( 'semver/functions/major' ); + +/** + * Executes npm command. + * + * @param {string} command command to execute + * @param {string} cwd dir where to execute command + * @returns {string|Buffer} + */ +function execNpmCommand( command, cwd = __dirname ) { + const cmd = `npm ${command}`; + + return execSync( cmd, { + encoding: 'utf-8', + cwd + } ); +} + + +/** + * Executes npx command. + * + * @param {string} command command to execute + * @param {string} cwd dir where to execute command + * @returns {string|Buffer} + */ +function execNpxCommand( command, cwd = __dirname ) { + const cmd = `npx ${command}`; + + return execSync( cmd, { + encoding: 'utf-8', + cwd + } ); +} + + +/** + * Removes directory and its children. + * + * @param {string} path dir path + * @returns {undefined} + */ +function rmdirSyncRecursive( path ) { + return rmdirSync( path, { + recursive: true + } ); +} + +/** + * Copies files and directories from source to dest. + * + * @param options + * @param {string} options.files list of files and dirs + * @param {string} options.src source path + * @param {string} options.dest destination path + * @param {string} options.version currently tested Angular version + */ +function copyFiles( options ) { + options.files.forEach( file => { + if ( file.versions === 'all' || file.versions.indexOf( semverMajor( options.version ) ) >= 0 ) { + const srcPath = resolvePath( options.src, file.src ); + const destPath = resolvePath( options.dest, file.dest ); + + copySync( srcPath, destPath ); + } + } ); +} + +module.exports = { + execNpmCommand: execNpmCommand, + execNpxCommand: execNpxCommand, + rmdirSyncRecursive: rmdirSyncRecursive, + copyFiles: copyFiles +} diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 792d3eed..a940566b 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -1,13 +1,13 @@ /* eslint-env node */ -const { execSync } = require( 'child_process' ); -const { mkdirSync, rmdirSync, unlinkSync } = require( 'fs' ); -const { copySync } = require( 'fs-extra' ); +const { mkdirSync, unlinkSync } = require( 'fs' ); const { resolve: resolvePath } = require( 'path' ); -const satisfiesSemver = require( 'semver/functions/satisfies' ); const semverMajor = require( 'semver/functions/major' ); const chalk = require( 'chalk' ); -const Logger = require( './logger' ); + +const Logger = require( './_helpers/logger' ); +const getVersions = require( './_helpers/getVersions' ); +const { execNpmCommand, execNpxCommand, rmdirSyncRecursive, copyFiles } = require( './_helpers/tools' ); /** * @@ -23,7 +23,7 @@ const Logger = require( './logger' ); */ const argv = require( 'minimist' )( process.argv.slice( 2 ) ); const testedBrowser = argv.browser || 'Chrome'; -const testedNgVersions = getVersionsToTest(); +const testedNgVersions = getVersions( argv.angular ); const noRebuild = argv.nr || false; const PACKAGE_PATH = resolvePath( __dirname, '..' ); @@ -81,136 +81,6 @@ function cleanupTestDir() { mkdirSync( TESTS_PATH ); } -/** - * Removes directory and its children. - * - * @param {string} path dir path - * @returns {undefined} - */ -function rmdirSyncRecursive( path ) { - return rmdirSync( path, { - recursive: true - } ); -} - - -/** - * Gets list of Angular versions to test based on `--angular` argument. - * - * @returns {string[]} list of versions to be tested - */ -function getVersionsToTest() { - switch ( argv.angular ) { - case 'all': - return getAllAngularVersions(); - case undefined: - return [ getCurrentAngularVersion() ]; - default: - return [ argv.angular ]; - } -} - -/** - * Gets list of all @angular/cli versions that can be tested. - * - * @returns {string[]} list of versions to test - */ -function getAllAngularVersions() { - const packageInfo = require( '../package.json' ); - const availableVersions = getVersions(); - const semverRange = getAngularVersion( packageInfo ); - const versionsInRange = getVersionsInRange( semverRange, availableVersions ); - return getLatestPatches( versionsInRange ); -} - -/** - * Gets list of available @angular/cli versions from npm. - * - * @returns {string[]} - */ -function getVersions() { - const commandResult = execNpmCommand( 'view @angular/cli versions --json' ); - const versions = JSON.parse( commandResult ); - - return versions; -} - -/** - * Gets peered version range from `package.json`. - * - * @param {Object} packageInfo contents of `package.json` - * @returns {string} peered version / version range - */ -function getAngularVersion( packageInfo ) { - const peerDependencies = packageInfo.peerDependencies; - const angular = peerDependencies[ '@angular/cli' ]; - - return angular; -} - -/** - * Filters versions based on requested range. - * - * @param {string} range version range - * @param {string[]} versions list of versions - * @returns {string[]} versions in requested range - */ -function getVersionsInRange( range, versions ) { - return versions.filter( version => { - return satisfiesSemver( version, range ); - } ); -} - -/** - * Gets latest patches for each major version. - * - * @param {string[]} versions list of versions - * @returns {string[]} list of latest patches - */ -function getLatestPatches( versions ) { - const latestPatches = versions.reduce( ( acc, version, index, array ) => { - if ( isLatestPatch( index, array ) ) { - acc.push( version ); - } - - return acc; - }, [] ); - - logger.logInfo( `Versions that will be tested ( ${chalk.cyan( latestPatches.length )} ): ${chalk.cyan( latestPatches )}` ); - - return latestPatches; -} - -/** - * Checks if version is latest patch of given list of versions. - * - * @param {number} index current index - * @param {string[]} array list of versions - * @returns {boolean} if version is latest patch - */ -function isLatestPatch( index, array ) { - // Skip checking the last array element. - if ( array.length == index + 1 ) { - return true; - } - - if ( semverMajor( array[ index ] ) != semverMajor( array[ index + 1 ] ) ) { - return true; - } else { - return false; - } -} - - -/** - * Gets currently installed version of Angular. - * - * @returns {string} Angular version - */ -function getCurrentAngularVersion() { - return require( '@angular/cli/package.json' ).version; -} - /** * Prepares test dir by copying required files and installing dependencies. @@ -272,61 +142,6 @@ function prepareTestDir( version ) { } -/** - * Executes npm command. - * - * @param {string} command command to execute - * @param {string} cwd dir where to execute command - * @returns {string|Buffer} - */ -function execNpmCommand( command, cwd = __dirname ) { - const cmd = `npm ${command}`; - - return execSync( cmd, { - encoding: 'utf-8', - cwd - } ); -} - - -/** - * Executes npx command. - * - * @param {string} command command to execute - * @param {string} cwd dir where to execute command - * @returns {string|Buffer} - */ -function execNpxCommand( command, cwd = __dirname ) { - const cmd = `npx ${command}`; - - return execSync( cmd, { - encoding: 'utf-8', - cwd - } ); -} - - -/** - * Copies files and directories from source to dest. - * - * @param options - * @param {string} options.files list of files and dirs - * @param {string} options.src source path - * @param {string} options.dest destination path - * @param {string} options.version currently tested Angular version - */ -function copyFiles( options ) { - options.files.forEach( file => { - if ( file.versions === 'all' || file.versions.indexOf( semverMajor( options.version ) ) >= 0 ) { - const srcPath = resolvePath( options.src, file.src ); - const destPath = resolvePath( options.dest, file.dest ); - - copySync( srcPath, destPath ); - } - } ); -} - - /** * Runs tests for requested Angular version and environment (see `--browser` arg). * From 7bacf268e0949a529762527abd8b59d60440707b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 12:44:35 +0200 Subject: [PATCH 15/52] Minor cleanup. --- scripts/_helpers/getVersions.js | 6 ++++++ scripts/_helpers/tools.js | 3 ++- scripts/angular-tester.js | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index f29ba7e0..96ff4dbe 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -19,6 +19,7 @@ function getVersions( command ) { } } + /** * Gets list of all @angular/cli versions that can be tested. * @@ -32,6 +33,7 @@ function getAllAngularVersions() { return getLatestPatches( versionsInRange ); } + /** * Gets list of available @angular/cli versions from npm. * @@ -44,6 +46,7 @@ function getNpmVersions() { return versions; } + /** * Gets peered version range from `package.json`. * @@ -57,6 +60,7 @@ function getAngularVersion( packageInfo ) { return angular; } + /** * Filters versions based on requested range. * @@ -70,6 +74,7 @@ function getVersionsInRange( range, versions ) { } ); } + /** * Gets latest patches for each major version. * @@ -91,6 +96,7 @@ function getLatestPatches( versions ) { return latestPatches; } + /** * Checks if version is latest patch of given list of versions. * diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index cedeaede..9bee373e 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -49,10 +49,11 @@ function rmdirSyncRecursive( path ) { } ); } + /** * Copies files and directories from source to dest. * - * @param options + * @param {object} options * @param {string} options.files list of files and dirs * @param {string} options.src source path * @param {string} options.dest destination path diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index a940566b..0f58d32f 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -71,6 +71,7 @@ try { process.exit( 1 ); } + /** * Removes test directory and its content, then re-creates empty test dir. */ @@ -167,6 +168,12 @@ function testVersion( version ) { } } + +/** + * Displays versions and corresponding failed tests. + * + * @param {object} errorLogs key-value pairs of ng versions and failed tests + */ function logErrors( errorLogs ) { logger.logBanner( 'error', 'Logs of failed versions' ); From d9f312faa2a4f164d90515c3823b5be9185d6b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 12:55:56 +0200 Subject: [PATCH 16/52] Log npm and npx commands. --- scripts/_helpers/logger.js | 4 ++++ scripts/_helpers/tools.js | 9 +++++++++ scripts/angular-tester.js | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/_helpers/logger.js b/scripts/_helpers/logger.js index c33dcac8..e81ee9db 100644 --- a/scripts/_helpers/logger.js +++ b/scripts/_helpers/logger.js @@ -23,6 +23,10 @@ module.exports = class Logger { console.log( chalk.yellow( message ) + '\n' ); } + logCode( message ) { + console.log( chalk.italic.bold( message ) + '\n' ); + } + logInfo( message ) { console.log( message ); } diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index 9bee373e..e139c066 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -1,7 +1,12 @@ const { execSync } = require( 'child_process' ); const { rmdirSync } = require( 'fs' ); +const { resolve: resolvePath } = require( 'path' ); const { copySync } = require( 'fs-extra' ); const semverMajor = require( 'semver/functions/major' ); +const Logger = require( './logger' ); + +const logger = new Logger(); + /** * Executes npm command. @@ -13,6 +18,8 @@ const semverMajor = require( 'semver/functions/major' ); function execNpmCommand( command, cwd = __dirname ) { const cmd = `npm ${command}`; + logger.logCode( cmd ); + return execSync( cmd, { encoding: 'utf-8', cwd @@ -30,6 +37,8 @@ function execNpmCommand( command, cwd = __dirname ) { function execNpxCommand( command, cwd = __dirname ) { const cmd = `npx ${command}`; + logger.logCode( cmd ); + return execSync( cmd, { encoding: 'utf-8', cwd diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 0f58d32f..acf75711 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -66,7 +66,7 @@ try { } } catch ( error ) { logger.logWarning( error ); - logger.logHeader( 'error', 'Unexpected error occured during testing - see the log above.' ); + logger.logHeader( 'Unexpected error occured during testing - see the log above.' ); process.exit( 1 ); } From e4978eb9ed19e5781c3c55a7aab9a2d41f944568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 13:23:42 +0200 Subject: [PATCH 17/52] Adjust logs if using prepared angular version. --- scripts/angular-tester.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index acf75711..f8aa8664 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -43,7 +43,8 @@ try { testedNgVersions.forEach( version => { if ( noRebuild ) { - logger.logWarning( '`no-rebuild` option detected; using existing testing directory.' ); + version = getPreparedNgVersion() + logger.logWarning( '`no-rebuild` option detected; using existing testing directory with @angular/cli ' + version + ' instead.' ); } else { cleanupTestDir(); prepareTestDir( version ); @@ -72,6 +73,14 @@ try { } +/** + * Finds the preinstalled @angular/cli version that will be tested. + */ +function getPreparedNgVersion() { + return require( resolvePath( TESTS_PATH, 'package.json' ) ).dependencies[ '@angular/cli' ]; +} + + /** * Removes test directory and its content, then re-creates empty test dir. */ From 98df80196fa8aefeedc303d27cacc5c1e8efd17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 13:28:08 +0200 Subject: [PATCH 18/52] Add TEST_APP_PATH const. --- scripts/angular-tester.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index f8aa8664..0eeb28c7 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -28,6 +28,7 @@ const noRebuild = argv.nr || false; const PACKAGE_PATH = resolvePath( __dirname, '..' ); const TESTS_PATH = resolvePath( PACKAGE_PATH, '..', 'angular-tests' ); +const TEST_APP_PATH = resolvePath( TESTS_PATH, 'cke4-angular-tester' ) const versionsPassed = []; const versionsFailed = []; @@ -131,22 +132,22 @@ function prepareTestDir( version ) { logger.logAction( 'Installing other required packages...' ); execNpmCommand( `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, - resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + TEST_APP_PATH ); if ( [ 6, 7 ].indexOf( semverMajor( version ) ) >= 0 ) { execNpmCommand( `i zone.js@0.10.3`, - resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + TEST_APP_PATH ); } logger.logAction( 'Copying integration and tests files...' ); - unlinkSync( resolvePath( TESTS_PATH, 'cke4-angular-tester/src/app/app.component.spec.ts' ) ); + unlinkSync( resolvePath( TEST_APP_PATH, 'src/app/app.component.spec.ts' ) ); copyFiles( { files: filesToCopy, src: resolvePath( PACKAGE_PATH, 'src' ), - dest: resolvePath( TESTS_PATH, 'cke4-angular-tester/src' ), + dest: resolvePath( TEST_APP_PATH, 'src' ), version: version } ); } @@ -164,7 +165,7 @@ function testVersion( version ) { logger.logAction( 'Executing tests...' ); execNpmCommand( `run test -- --browsers ${testedBrowser}`, - resolvePath( TESTS_PATH, 'cke4-angular-tester' ) + TEST_APP_PATH ); versionsPassed.push( version ); } catch ( error ) { From 8c881ff22f3d6fe35db69544b492ce9ae516d9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 14:28:46 +0200 Subject: [PATCH 19/52] Improve logging array of tested versions. --- scripts/_helpers/getVersions.js | 1 + scripts/angular-tester.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 96ff4dbe..021be97c 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -92,6 +92,7 @@ function getLatestPatches( versions ) { // @todo // logger.logInfo( `Versions that will be tested ( ${chalk.cyan( latestPatches.length )} ): ${chalk.cyan( latestPatches )}` ); + // logger.logInfo( `Versions that will be tested ( ` + latestPatches ); return latestPatches; } diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 0eeb28c7..f03269d0 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -38,8 +38,9 @@ const logger = new Logger(); try { logger.logBanner( 'info', 'Ultimate CKEditor4-Angular Integration Tester' ) - logger.logInfo( `Running tests for: ${chalk.cyan( testedBrowser )}` ); - logger.logInfo( `Angular versions to be tested: ${chalk.cyan( testedNgVersions )}\n` ); + logger.logInfo( `Running tests for: ${chalk.green( testedBrowser )}` ); + logger.logInfo( `Angular versions to be tested ( ${chalk.green( testedNgVersions.length ) } ):` ); + logger.logInfo( testedNgVersions ); logger.logHeader( 'Preparing testing directory' ); testedNgVersions.forEach( version => { From 08cf5543a88aaec979153ec2ec5a979bb0920253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:16:36 +0200 Subject: [PATCH 20/52] Add license banners. --- scripts/_helpers/getVersions.js | 7 +++++++ scripts/_helpers/logger.js | 7 +++++++ scripts/_helpers/tools.js | 7 +++++++ scripts/angular-tester.js | 7 ++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 021be97c..4498ab47 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -1,3 +1,10 @@ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +'use strict'; + const satisfiesSemver = require( 'semver/functions/satisfies' ); const semverMajor = require( 'semver/functions/major' ); const { execNpmCommand } = require( './tools' ); diff --git a/scripts/_helpers/logger.js b/scripts/_helpers/logger.js index e81ee9db..ec9f19b2 100644 --- a/scripts/_helpers/logger.js +++ b/scripts/_helpers/logger.js @@ -1,3 +1,10 @@ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +'use strict'; + const chalk = require( 'chalk' ); module.exports = class Logger { diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index e139c066..897216bd 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -1,3 +1,10 @@ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +'use strict'; + const { execSync } = require( 'child_process' ); const { rmdirSync } = require( 'fs' ); const { resolve: resolvePath } = require( 'path' ); diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index f03269d0..0b6854c6 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -1,4 +1,9 @@ -/* eslint-env node */ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +'use strict'; const { mkdirSync, unlinkSync } = require( 'fs' ); const { resolve: resolvePath } = require( 'path' ); From 85af9a782a76015dd03f53a5594d252d2b1f0c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:16:43 +0200 Subject: [PATCH 21/52] Cleanup. --- scripts/_helpers/getVersions.js | 4 ---- scripts/angular-tester.js | 15 +++++++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 4498ab47..86c57ba2 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -97,10 +97,6 @@ function getLatestPatches( versions ) { return acc; }, [] ); - // @todo - // logger.logInfo( `Versions that will be tested ( ${chalk.cyan( latestPatches.length )} ): ${chalk.cyan( latestPatches )}` ); - // logger.logInfo( `Versions that will be tested ( ` + latestPatches ); - return latestPatches; } diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 0b6854c6..80f5ed50 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -48,6 +48,13 @@ try { logger.logInfo( testedNgVersions ); logger.logHeader( 'Preparing testing directory' ); + /* Versions with LTS (7): [ + '6.2.9', '7.3.10', + '8.3.29', '9.1.15', + '10.2.3', '11.2.14', + '12.0.4' + ] + '1.7.4' - no lts */ testedNgVersions.forEach( version => { if ( noRebuild ) { version = getPreparedNgVersion() @@ -59,14 +66,6 @@ try { testVersion( version ); } ); - /* Versions that will be tested (7): [ - '6.2.9', '7.3.10', - '8.3.29', '9.1.15', - '10.2.3', '11.2.14', - '12.0.4' - ] - '1.7.4' - not lts */ - if ( Object.keys( errorLogs ).length === 0 ) { logger.logHeader( 'success', 'Done without errors. Have a nice day!' ); } else { From 8f17a8d23a363995a8c8ab3d880fb44ef001bb25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:18:43 +0200 Subject: [PATCH 22/52] Log path together with commands. --- scripts/_helpers/tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index 897216bd..89216ebc 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -25,7 +25,7 @@ const logger = new Logger(); function execNpmCommand( command, cwd = __dirname ) { const cmd = `npm ${command}`; - logger.logCode( cmd ); + logger.logCode( `${cwd} > ${cmd}` ); return execSync( cmd, { encoding: 'utf-8', @@ -44,7 +44,7 @@ function execNpmCommand( command, cwd = __dirname ) { function execNpxCommand( command, cwd = __dirname ) { const cmd = `npx ${command}`; - logger.logCode( cmd ); + logger.logCode( `${cwd} > ${cmd}` ); return execSync( cmd, { encoding: 'utf-8', From 1391fcf33056d31828adf2a370b6deb382593bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:21:54 +0200 Subject: [PATCH 23/52] Move custom test files. --- scripts/angular-tester.js | 16 ++++++++-------- {src => scripts}/assets/demo-form.component.ts | 0 {src => scripts}/assets/karma.conf.js | 0 {src => scripts}/assets/tsconfig.json | 0 4 files changed, 8 insertions(+), 8 deletions(-) rename {src => scripts}/assets/demo-form.component.ts (100%) rename {src => scripts}/assets/karma.conf.js (100%) rename {src => scripts}/assets/tsconfig.json (100%) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 80f5ed50..2a4b167c 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -107,13 +107,13 @@ function prepareTestDir( version ) { logger.logHeader( `Preparing environment for ${chalk.italic( '@angular/cli@' + version )}` ); const filesToCopy = [ - { src: 'app', dest: 'app', versions: 'all' }, - { src: 'ckeditor', dest: 'ckeditor', versions: 'all' }, - { src: 'test.tools.ts', dest: 'test.tools.ts', versions: 'all' }, - { src: 'assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 6, 7 ] }, - { src: 'assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, - { src: 'assets/tsconfig.json', dest: '../tsconfig.json', versions: [ 12 ] }, - { src: 'assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } + { src: 'src/app', dest: 'app', versions: 'all' }, + { src: 'src/ckeditor', dest: 'ckeditor', versions: 'all' }, + { src: 'src/test.tools.ts', dest: 'test.tools.ts', versions: 'all' }, + { src: 'scripts/assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 6, 7 ] }, + { src: 'scripts/assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, + { src: 'scripts/assets/tsconfig.json', dest: '../tsconfig.json', versions: [ 12 ] }, + { src: 'scripts/assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); @@ -151,7 +151,7 @@ function prepareTestDir( version ) { unlinkSync( resolvePath( TEST_APP_PATH, 'src/app/app.component.spec.ts' ) ); copyFiles( { files: filesToCopy, - src: resolvePath( PACKAGE_PATH, 'src' ), + src: PACKAGE_PATH, dest: resolvePath( TEST_APP_PATH, 'src' ), version: version } ); diff --git a/src/assets/demo-form.component.ts b/scripts/assets/demo-form.component.ts similarity index 100% rename from src/assets/demo-form.component.ts rename to scripts/assets/demo-form.component.ts diff --git a/src/assets/karma.conf.js b/scripts/assets/karma.conf.js similarity index 100% rename from src/assets/karma.conf.js rename to scripts/assets/karma.conf.js diff --git a/src/assets/tsconfig.json b/scripts/assets/tsconfig.json similarity index 100% rename from src/assets/tsconfig.json rename to scripts/assets/tsconfig.json From 1fe22f78ae0cd352ca523b13978dd08c51c08711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:37:00 +0200 Subject: [PATCH 24/52] Renaming. --- scripts/angular-tester.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 2a4b167c..117916dc 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -32,8 +32,8 @@ const testedNgVersions = getVersions( argv.angular ); const noRebuild = argv.nr || false; const PACKAGE_PATH = resolvePath( __dirname, '..' ); -const TESTS_PATH = resolvePath( PACKAGE_PATH, '..', 'angular-tests' ); -const TEST_APP_PATH = resolvePath( TESTS_PATH, 'cke4-angular-tester' ) +const TESTS_PATH = resolvePath( PACKAGE_PATH, '..', 'cke4-angular-tester' ); +const TEST_APP_PATH = resolvePath( TESTS_PATH, 'cke4-angular-app' ) const versionsPassed = []; const versionsFailed = []; @@ -48,11 +48,11 @@ try { logger.logInfo( testedNgVersions ); logger.logHeader( 'Preparing testing directory' ); - /* Versions with LTS (7): [ + /* Versions with LTS + latest one (7): [ '6.2.9', '7.3.10', '8.3.29', '9.1.15', '10.2.3', '11.2.14', - '12.0.4' + '12.0.5' ] '1.7.4' - no lts */ testedNgVersions.forEach( version => { @@ -130,7 +130,7 @@ function prepareTestDir( version ) { logger.logAction( 'Initializing Angular project...' ); execNpxCommand( - `ng new cke4-angular-tester`, + `ng new cke4-angular-app`, TESTS_PATH ) From f09b34563b71404b045b0bcfdb94601c38de1878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:44:56 +0200 Subject: [PATCH 25/52] Improve logging. --- scripts/angular-tester.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 117916dc..2936fca2 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -67,13 +67,13 @@ try { } ); if ( Object.keys( errorLogs ).length === 0 ) { - logger.logHeader( 'success', 'Done without errors. Have a nice day!' ); + logger.logBanner( 'success', 'Done without errors. Have a nice day!' ); } else { logErrors( errorLogs ); } } catch ( error ) { logger.logWarning( error ); - logger.logHeader( 'Unexpected error occured during testing - see the log above.' ); + logger.logBanner( 'error', 'Unexpected error occured during testing - see the log above.' ); process.exit( 1 ); } @@ -172,6 +172,8 @@ function testVersion( version ) { `run test -- --browsers ${testedBrowser}`, TEST_APP_PATH ); + logger.logWarning( `All tests for ${chalk.italic( '@angular/cli@' + version )} passed. Moving forward.` ); + versionsPassed.push( version ); } catch ( error ) { logger.logWarning( 'Errors occured during testing version ' + version + '. See the logs at the bottom after testing is finished.' ); @@ -199,9 +201,9 @@ function logErrors( errorLogs ) { logger.logBanner( 'error', 'Testing done. Some versions failed. See the logs above.' ); logger.logInfo( 'Successfully tested versions:' ); - logger.logInfo( chalk.green( versionsPassed + '\n' ) ); + logger.logInfo( versionsPassed ); logger.logInfo( 'Unsuccessfully tested versions:' ); - logger.logInfo( chalk.red( versionsFailed ) + '\n' ); + logger.logInfo( versionsFailed ); process.exit( 1 ); } From 1ff1fc583e92d359828ba94eea2112bf0d6d9780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 16:54:21 +0200 Subject: [PATCH 26/52] Remove leftovers. --- scripts/angular-tester.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 2936fca2..b720136b 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -166,12 +166,12 @@ function prepareTestDir( version ) { function testVersion( version ) { try { logger.logHeader( `Testing ${chalk.italic( '@angular/cli@' + version )}` ); - // process.env.REQUESTED_ANGULAR_VERSION = version; logger.logAction( 'Executing tests...' ); execNpmCommand( `run test -- --browsers ${testedBrowser}`, TEST_APP_PATH ); + logger.logWarning( `All tests for ${chalk.italic( '@angular/cli@' + version )} passed. Moving forward.` ); versionsPassed.push( version ); @@ -180,8 +180,6 @@ function testVersion( version ) { versionsFailed.push( version ); errorLogs[ version ] = error.stdout; - - // throw error; } } From 6e42bbe7b777d852c6f830e222c05876fda60c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 17:02:43 +0200 Subject: [PATCH 27/52] Improve readability of banners. --- scripts/_helpers/logger.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_helpers/logger.js b/scripts/_helpers/logger.js index ec9f19b2..7efcb25a 100644 --- a/scripts/_helpers/logger.js +++ b/scripts/_helpers/logger.js @@ -51,11 +51,11 @@ module.exports = class Logger { _getColor( type ) { switch ( type ) { case 'success': - return 'green'; + return 'bgGreen'; case 'info': - return 'blue'; + return 'bgBlue'; case 'error': - return 'red'; + return 'bgRed'; } } } From 9c4939386501c224e67a3ead74bd479801daebe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 17:03:00 +0200 Subject: [PATCH 28/52] Change dest paths of files to copy. --- scripts/angular-tester.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index b720136b..c3d0e158 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -107,13 +107,13 @@ function prepareTestDir( version ) { logger.logHeader( `Preparing environment for ${chalk.italic( '@angular/cli@' + version )}` ); const filesToCopy = [ - { src: 'src/app', dest: 'app', versions: 'all' }, - { src: 'src/ckeditor', dest: 'ckeditor', versions: 'all' }, - { src: 'src/test.tools.ts', dest: 'test.tools.ts', versions: 'all' }, - { src: 'scripts/assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 6, 7 ] }, - { src: 'scripts/assets/karma.conf.js', dest: '../karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, - { src: 'scripts/assets/tsconfig.json', dest: '../tsconfig.json', versions: [ 12 ] }, - { src: 'scripts/assets/demo-form.component.ts', dest: 'app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } + { src: 'src/app', dest: 'src/app', versions: 'all' }, + { src: 'src/ckeditor', dest: 'src/ckeditor', versions: 'all' }, + { src: 'src/test.tools.ts', dest: 'src/test.tools.ts', versions: 'all' }, + { src: 'scripts/assets/karma.conf.js', dest: 'src/karma.conf.js', versions: [ 6, 7 ] }, + { src: 'scripts/assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, + { src: 'scripts/assets/tsconfig.json', dest: 'tsconfig.json', versions: [ 12 ] }, + { src: 'scripts/assets/demo-form.component.ts', dest: 'src/app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); @@ -152,7 +152,7 @@ function prepareTestDir( version ) { copyFiles( { files: filesToCopy, src: PACKAGE_PATH, - dest: resolvePath( TEST_APP_PATH, 'src' ), + dest: TEST_APP_PATH, version: version } ); } From f58baa76bf24e81ac3d5be9925d9053ffc605b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 17:07:58 +0200 Subject: [PATCH 29/52] Clarify some docs. --- scripts/_helpers/logger.js | 3 +++ scripts/_helpers/tools.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/_helpers/logger.js b/scripts/_helpers/logger.js index 7efcb25a..937d8d63 100644 --- a/scripts/_helpers/logger.js +++ b/scripts/_helpers/logger.js @@ -7,6 +7,9 @@ const chalk = require( 'chalk' ); +/** + * Small logging utility class. + */ module.exports = class Logger { constructor() {} diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index 89216ebc..1f4dcc1b 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -67,9 +67,9 @@ function rmdirSyncRecursive( path ) { /** - * Copies files and directories from source to dest. + * Copies files and directories matching currently tested ng version from source to dest. * - * @param {object} options + * @param {Object} options * @param {string} options.files list of files and dirs * @param {string} options.src source path * @param {string} options.dest destination path From 917e7474ef6dc5a38a75e1a64d6dfb25cb1a23ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Mon, 21 Jun 2021 17:16:34 +0200 Subject: [PATCH 30/52] Enable testing with GH Actions. --- .github/workflows/test-all.yml | 69 +++++++++++++++++++++++++++++++++ scripts/_helpers/getVersions.js | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-all.yml diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml new file mode 100644 index 00000000..26edc9de --- /dev/null +++ b/.github/workflows/test-all.yml @@ -0,0 +1,69 @@ +name: Test browsers + +on: + pull_request: + branches: + - master + - stable + - major + push: + tags: + - v* + branches: + - master + - stable + - major + +jobs: + # Runs tests for selected Angular versions and all environments + # Top-level Angular version (as per package-lock.json) will be used for PRs. All versions of Angular will be tested otherwise. + test-all: + runs-on: ubuntu-20.04 + name: Run tests + strategy: + matrix: + browser: [BrowserStack_Edge, BrowserStack_Safari, BrowserStack_IE11, Chrome, Firefox] + fail-fast: false + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Setup Chrome + if: matrix.browser == 'Chrome' + uses: browser-actions/setup-chrome@latest + with: + chrome-version: stable + + - name: Setup Firefox + if: matrix.browser == 'Firefox' + uses: browser-actions/setup-firefox@latest + with: + firefox-version: latest + + # Set variables required for further steps. + # CHROME_BIN and FIREFOX_BIN are required by Karma. + # ANGULAR_VERSION is set to "current" for pull request events and "all" for other events. + # BUILD_SLUG corresponds to a BrowserStack job name. It's displayed as combination of repo name and short SHA. + - name: Set test variables + run: | + export CHROME_BIN=$(which chrome); + export FIREFOX_BIN=$(which firefox); + if [ -z ${GITHUB_HEAD_REF} ]; then echo "ANGULAR_VERSION=all"; else echo "ANGULAR_VERSION=current"; fi >> $GITHUB_ENV; + echo "BUILD_SLUG=$(echo $GITHUB_REPOSITORY | cut -d '/' -f2) $(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV; + + - name: Install dependencies + run: npm install + + # Run tests with the help of Xvfb, since there is no screen output available (required for locally installed browsers). + - name: Run tests + uses: GabrielBB/xvfb-action@v1 + env: + BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }} + BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }} + with: + run: npm run test:angular-tester -- --angular ${{ env.ANGULAR_VERSION }} --browser ${{ matrix.browser }} diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 86c57ba2..0776831f 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -19,7 +19,7 @@ function getVersions( command ) { switch ( command ) { case 'all': return getAllAngularVersions(); - case undefined: + case 'current': return [ getCurrentAngularVersion() ]; default: return [ command ]; From 36202e63f05d834fda7b00d77ef5d2fe79237aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Tue, 22 Jun 2021 10:02:31 +0200 Subject: [PATCH 31/52] Remove angular-tests from .gitignore - it's created outside the repo. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0d2fa72d..83c9dc67 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ yarn-error.log testem.log local.log /typings -angular-tests # System Files .DS_Store From 6d92a70a767f66a16ea3bd02db1eb0f718a6f2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 14:01:54 +0200 Subject: [PATCH 32/52] Remove leftover. --- scripts/angular-tester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index c3d0e158..632c6483 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -21,7 +21,7 @@ const { execNpmCommand, execNpxCommand, rmdirSyncRecursive, copyFiles } = requir * Commands: * * --browser Specifies environment to test. - * ??? Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11'. + * Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11'. * Defaults to: 'Chrome'. * --angular Specifies Angular version to test. Possible values: 'all', 'current' or specific version. Defaults to: 'current'. * From 1352f0e601a65425e9b840edef5929840a551a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 14:02:55 +0200 Subject: [PATCH 33/52] Rename argument in getVersions() method. --- scripts/_helpers/getVersions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 0776831f..ef37c21a 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -12,17 +12,17 @@ const { execNpmCommand } = require( './tools' ); /** * Gets list of Angular versions to test based on `--angular` argument. * - * @param {string} command + * @param {string} version * @returns {string[]} list of versions to be tested */ -function getVersions( command ) { - switch ( command ) { +function getVersions( version ) { + switch ( version ) { case 'all': return getAllAngularVersions(); case 'current': return [ getCurrentAngularVersion() ]; default: - return [ command ]; + return [ version ]; } } From 3f6c0ec2f73b3d397cf771f1c7d6db2da5423701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 14:42:04 +0200 Subject: [PATCH 34/52] Test latest angular/cli version if none was passed. --- scripts/_helpers/getVersions.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index ef37c21a..3a48529f 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -21,6 +21,8 @@ function getVersions( version ) { return getAllAngularVersions(); case 'current': return [ getCurrentAngularVersion() ]; + case undefined: + return [ getLatestAngularVersion() ]; default: return [ version ]; } @@ -131,4 +133,17 @@ function getCurrentAngularVersion() { return require( '@angular/cli/package.json' ).version; } + +/** + * Gets the latest @angular/cli version available on npm. + * + * @returns {string} the latest available @angular/cli version. + */ +function getLatestAngularVersion() { + const commandResult = execNpmCommand( 'view @angular/cli dist-tags --json' ); + const versions = JSON.parse( commandResult ); + + return versions.latest; +} + module.exports = getVersions; From e757ade0142e211a177e0539ccf1329b6c0bcbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 15:18:05 +0200 Subject: [PATCH 35/52] Simplify getting the versions list by using the dist-tags of angular/cli. --- scripts/_helpers/getVersions.js | 98 +++------------------------------ 1 file changed, 7 insertions(+), 91 deletions(-) diff --git a/scripts/_helpers/getVersions.js b/scripts/_helpers/getVersions.js index 3a48529f..5c4d2f62 100644 --- a/scripts/_helpers/getVersions.js +++ b/scripts/_helpers/getVersions.js @@ -5,20 +5,18 @@ 'use strict'; -const satisfiesSemver = require( 'semver/functions/satisfies' ); -const semverMajor = require( 'semver/functions/major' ); const { execNpmCommand } = require( './tools' ); /** * Gets list of Angular versions to test based on `--angular` argument. * * @param {string} version - * @returns {string[]} list of versions to be tested + * @returns {string[]} the list of versions to be tested */ function getVersions( version ) { switch ( version ) { case 'all': - return getAllAngularVersions(); + return getImportantVersions(); case 'current': return [ getCurrentAngularVersion() ]; case undefined: @@ -30,97 +28,15 @@ function getVersions( version ) { /** - * Gets list of all @angular/cli versions that can be tested. + * Gets the list of versions to test based on package dist-tags. * - * @returns {string[]} list of versions to test + * @returns {[string]} the list of current, next and lts versions */ -function getAllAngularVersions() { - const packageInfo = require( '../../package.json' ); - const availableVersions = getNpmVersions(); - const semverRange = getAngularVersion( packageInfo ); - const versionsInRange = getVersionsInRange( semverRange, availableVersions ); - return getLatestPatches( versionsInRange ); -} - - -/** - * Gets list of available @angular/cli versions from npm. - * - * @returns {string[]} - */ -function getNpmVersions() { - const commandResult = execNpmCommand( 'view @angular/cli versions --json' ); +function getImportantVersions() { + const commandResult = execNpmCommand( 'view @angular/cli dist-tags --json' ); const versions = JSON.parse( commandResult ); - return versions; -} - - -/** - * Gets peered version range from `package.json`. - * - * @param {Object} packageInfo contents of `package.json` - * @returns {string} peered version / version range - */ -function getAngularVersion( packageInfo ) { - const peerDependencies = packageInfo.peerDependencies; - const angular = peerDependencies[ '@angular/cli' ]; - - return angular; -} - - -/** - * Filters versions based on requested range. - * - * @param {string} range version range - * @param {string[]} versions list of versions - * @returns {string[]} versions in requested range - */ -function getVersionsInRange( range, versions ) { - return versions.filter( version => { - return satisfiesSemver( version, range ); - } ); -} - - -/** - * Gets latest patches for each major version. - * - * @param {string[]} versions list of versions - * @returns {string[]} list of latest patches - */ -function getLatestPatches( versions ) { - const latestPatches = versions.reduce( ( acc, version, index, array ) => { - if ( isLatestPatch( index, array ) ) { - acc.push( version ); - } - - return acc; - }, [] ); - - return latestPatches; -} - - -/** - * Checks if version is latest patch of given list of versions. - * - * @param {number} index current index - * @param {string[]} array list of versions - * @returns {boolean} if version is latest patch - */ -function isLatestPatch( index, array ) { - // Skip checking the last array element. - if ( array.length == index + 1 ) { - return true; - } - - if ( semverMajor( array[ index ] ) != semverMajor( array[ index + 1 ] ) ) { - return true; - } else { - return false; - } + return Object.values( versions ); } From 9834a0086823ab170bac2afb305d42bd5115d5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 15:21:06 +0200 Subject: [PATCH 36/52] Downgrade karma-browserstack-launcher. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3bad9e24..725becdd 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "jasmine-core": "^3.8.0", "jasmine-spec-reporter": "^7.0.0", "karma": "^6.3.4", - "karma-browserstack-launcher": "^1.6.0", + "karma-browserstack-launcher": "^1.4.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.3", "karma-firefox-launcher": "^2.1.1", From cbdec84e5cef88a86907c11ee67c48a6726b0330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 16:52:52 +0200 Subject: [PATCH 37/52] Remove unnecessary peerDependencies. --- package-lock.json | 60 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 ---- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 50a5cead..e5e7593e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -560,6 +560,17 @@ "js-tokens": "^4.0.0" } }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -571,6 +582,15 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -1683,6 +1703,26 @@ "chalk": "^2.0.0", "js-tokens": "^4.0.0" } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -1728,6 +1768,26 @@ "chalk": "^2.0.0", "js-tokens": "^4.0.0" } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, diff --git a/package.json b/package.json index 725becdd..e49bccdc 100644 --- a/package.json +++ b/package.json @@ -75,10 +75,6 @@ "wait-until-promise": "^1.0.0", "zone.js": "^0.11.4" }, - "peerDependencies": { - "ckeditor4": "^4.16.1", - "@angular/cli": ">=5" - }, "browserslist": [ "> 0.5%", "last 2 versions", From ca46cad60ee76300caa30ac8a3dd7011711b13cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 16:56:33 +0200 Subject: [PATCH 38/52] Remove italics from logger. --- scripts/_helpers/logger.js | 6 +----- scripts/_helpers/tools.js | 4 ++-- scripts/angular-tester.js | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/_helpers/logger.js b/scripts/_helpers/logger.js index 937d8d63..7855d6bd 100644 --- a/scripts/_helpers/logger.js +++ b/scripts/_helpers/logger.js @@ -33,12 +33,8 @@ module.exports = class Logger { console.log( chalk.yellow( message ) + '\n' ); } - logCode( message ) { - console.log( chalk.italic.bold( message ) + '\n' ); - } - logInfo( message ) { - console.log( message ); + console.log( message + '\n' ); } _decorateBanner( message ) { diff --git a/scripts/_helpers/tools.js b/scripts/_helpers/tools.js index 1f4dcc1b..36abb91e 100644 --- a/scripts/_helpers/tools.js +++ b/scripts/_helpers/tools.js @@ -25,7 +25,7 @@ const logger = new Logger(); function execNpmCommand( command, cwd = __dirname ) { const cmd = `npm ${command}`; - logger.logCode( `${cwd} > ${cmd}` ); + logger.logInfo( `${cwd} > ${cmd}` ); return execSync( cmd, { encoding: 'utf-8', @@ -44,7 +44,7 @@ function execNpmCommand( command, cwd = __dirname ) { function execNpxCommand( command, cwd = __dirname ) { const cmd = `npx ${command}`; - logger.logCode( `${cwd} > ${cmd}` ); + logger.logInfo( `${cwd} > ${cmd}` ); return execSync( cmd, { encoding: 'utf-8', diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 632c6483..66ab0c2c 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -45,7 +45,7 @@ try { logger.logBanner( 'info', 'Ultimate CKEditor4-Angular Integration Tester' ) logger.logInfo( `Running tests for: ${chalk.green( testedBrowser )}` ); logger.logInfo( `Angular versions to be tested ( ${chalk.green( testedNgVersions.length ) } ):` ); - logger.logInfo( testedNgVersions ); + console.log( testedNgVersions ); logger.logHeader( 'Preparing testing directory' ); /* Versions with LTS + latest one (7): [ From 9bec8c85b157d1d8f27029a02a485eb1f104a09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Jarz=C4=99bski?= Date: Fri, 16 Jul 2021 16:58:08 +0200 Subject: [PATCH 39/52] Generalise the comment with versions. --- scripts/angular-tester.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 66ab0c2c..e32c5e83 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -48,13 +48,11 @@ try { console.log( testedNgVersions ); logger.logHeader( 'Preparing testing directory' ); - /* Versions with LTS + latest one (7): [ + /* Versions with LTS: [ '6.2.9', '7.3.10', '8.3.29', '9.1.15', - '10.2.3', '11.2.14', - '12.0.5' - ] - '1.7.4' - no lts */ + '10.2.3', '11.2.14' + ] */ testedNgVersions.forEach( version => { if ( noRebuild ) { version = getPreparedNgVersion() From 7ea841a567d0efa5561db8359b3d389cc91decc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 14:33:15 +0200 Subject: [PATCH 40/52] Add karma-browserstack-launcher pkg --- package.json | 2 +- scripts/angular-tester.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e49bccdc..003c4609 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "jasmine-core": "^3.8.0", "jasmine-spec-reporter": "^7.0.0", "karma": "^6.3.4", - "karma-browserstack-launcher": "^1.4.0", + "karma-browserstack-launcher": "1.4.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.3", "karma-firefox-launcher": "^2.1.1", diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index e32c5e83..9f1d0ff1 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -134,7 +134,7 @@ function prepareTestDir( version ) { logger.logAction( 'Installing other required packages...' ); execNpmCommand( - `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter`, + `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter karma-browserstack-launcher`, TEST_APP_PATH ); From 6b2a2c8a73eeaee1bd20a7cf683305820efb8bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 14:52:03 +0200 Subject: [PATCH 41/52] Use build name from workflow --- scripts/angular-tester.js | 2 +- scripts/assets/karma.conf.js | 111 ++++++++++++++--------------------- 2 files changed, 44 insertions(+), 69 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 9f1d0ff1..ebe2f09b 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -128,7 +128,7 @@ function prepareTestDir( version ) { logger.logAction( 'Initializing Angular project...' ); execNpxCommand( - `ng new cke4-angular-app`, + `ng new cke4-angular-app --skip-git`, TESTS_PATH ) diff --git a/scripts/assets/karma.conf.js b/scripts/assets/karma.conf.js index a95d7cfd..c310f984 100644 --- a/scripts/assets/karma.conf.js +++ b/scripts/assets/karma.conf.js @@ -2,28 +2,29 @@ // https://karma-runner.github.io/1.0/config/configuration-file.html let options = process.env.KARMA_OPTIONS; -options = options ? JSON.parse( options ) : {}; +options = options ? JSON.parse(options) : {}; -module.exports = function ( config ) { - const browsers = config.browsers.length === 0 ? [ 'Chrome' ] : config.browsers; +module.exports = function (config) { + const browsers = + config.browsers.length === 0 ? ["Chrome"] : config.browsers; - config.set( { - basePath: '', - frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], + config.set({ + basePath: "", + frameworks: ["jasmine", "@angular-devkit/build-angular"], plugins: getPlugins(), client: { clearContext: false, // leave Jasmine Spec Runner output visible in browser captureConsole: false, jasmine: { - random: false - } + random: false, + }, }, coverageIstanbulReporter: { - dir: require( 'path' ).join( __dirname, '../coverage' ), - reports: [ 'html', 'lcovonly' ], - fixWebpackSourcePaths: true + dir: require("path").join(__dirname, "../coverage"), + reports: ["html", "lcovonly"], + fixWebpackSourcePaths: true, }, - reporters: [ 'spec' ], + reporters: ["spec"], port: 9876, colors: true, logLevel: config.LOG_INFO, @@ -40,87 +41,61 @@ module.exports = function ( config ) { specReporter: { suppressPassed: true, suppressErrorSummary: true, - maxLogLines: 8 + maxLogLines: 8, }, - ...( options.url && { files: [ options.url ] } ), + ...(options.url && { files: [options.url] }), customLaunchers: { BrowserStack_Edge: { - base: 'BrowserStack', - os: 'Windows', - os_version: '10', - browser: 'edge' + base: "BrowserStack", + os: "Windows", + os_version: "10", + browser: "edge", }, BrowserStack_IE11: { - base: 'BrowserStack', - os: 'Windows', - os_version: '10', - browser: 'ie', - browser_version: '11.0' + base: "BrowserStack", + os: "Windows", + os_version: "10", + browser: "ie", + browser_version: "11.0", }, BrowserStack_Safari: { - base: 'BrowserStack', - os: 'OS X', - os_version: 'Big Sur', - browser: 'safari' - } + base: "BrowserStack", + os: "OS X", + os_version: "Big Sur", + browser: "safari", + }, }, browserStack: { username: process.env.BROWSER_STACK_USERNAME, accessKey: process.env.BROWSER_STACK_ACCESS_KEY, - build: getBuildName(), - project: 'ckeditor4' + build: process.env.BUILD_SLUG, + project: "ckeditor4", }, - } ); + }); }; -// Formats name of the build for BrowserStack. It merges a repository name and current timestamp. -// If env variable `TRAVIS_REPO_SLUG` is not available, the function returns `undefined`. -// -// @returns {String|undefined} -function getBuildName() { - const repoSlug = process.env.TRAVIS_REPO_SLUG; - - if ( !repoSlug ) { - return; - } - - const repositoryName = repoSlug.split( '/' )[ 1 ].replace( /-/g, '_' ); - const date = new Date().getTime(); - - return `${ repositoryName } ${ date }`; -} - function getPlugins() { const plugins = [ - require( 'karma-jasmine' ), - require( 'karma-chrome-launcher' ), - require( 'karma-firefox-launcher' ), - require( '@angular-devkit/build-angular/plugins/karma' ), - require( 'karma-spec-reporter' ) + require("karma-jasmine"), + require("karma-chrome-launcher"), + require("karma-firefox-launcher"), + require("@angular-devkit/build-angular/plugins/karma"), + require("karma-spec-reporter"), ]; - if ( shouldEnableBrowserStack() ) { - plugins.push( - require( 'karma-browserstack-launcher' ) - ); + if (shouldEnableBrowserStack()) { + plugins.push(require("karma-browserstack-launcher")); } return plugins; } function shouldEnableBrowserStack() { - if ( !process.env.BROWSER_STACK_USERNAME ) { - return false; - } - - if ( !process.env.BROWSER_STACK_ACCESS_KEY ) { - return false; - } - - // If the repository slugs are different, the pull request comes from the community (forked repository). - // For such builds, BrowserStack will be disabled. Read more: https://github.com/ckeditor/ckeditor5-dev/issues/358. - return ( process.env.TRAVIS_EVENT_TYPE !== 'pull_request' || process.env.TRAVIS_PULL_REQUEST_SLUG === process.env.TRAVIS_REPO_SLUG ); + return ( + process.env.BROWSER_STACK_ACCESS_KEY && + process.env.BROWSER_STACK_ACCESS_KEY + ); } From c68b506f3a39ae66b4d3763853d1ca4aa85b5173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 15:14:53 +0200 Subject: [PATCH 42/52] Use npx --- scripts/angular-tester.js | 14 +------------- scripts/assets/karma.conf.js | 5 +---- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index ebe2f09b..14bcb609 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -114,21 +114,9 @@ function prepareTestDir( version ) { { src: 'scripts/assets/demo-form.component.ts', dest: 'src/app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; - logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); - execNpmCommand( - `init -y`, - TESTS_PATH - ) - - logger.logAction( `Installing ${chalk.italic( '@angular/cli' )} locally...` ); - execNpmCommand( - `i @angular/cli@${version}`, - TESTS_PATH - ); - logger.logAction( 'Initializing Angular project...' ); execNpxCommand( - `ng new cke4-angular-app --skip-git`, + `npx ng new cke4-angular-app --skip-git`, TESTS_PATH ) diff --git a/scripts/assets/karma.conf.js b/scripts/assets/karma.conf.js index c310f984..0bd305f6 100644 --- a/scripts/assets/karma.conf.js +++ b/scripts/assets/karma.conf.js @@ -5,9 +5,6 @@ let options = process.env.KARMA_OPTIONS; options = options ? JSON.parse(options) : {}; module.exports = function (config) { - const browsers = - config.browsers.length === 0 ? ["Chrome"] : config.browsers; - config.set({ basePath: "", frameworks: ["jasmine", "@angular-devkit/build-angular"], @@ -29,7 +26,7 @@ module.exports = function (config) { colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers, + browsers: config.browsers, singleRun: !options.watch, concurrency: 2, From 6a829101aa31babb797f835cd96040b61599a277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 15:19:11 +0200 Subject: [PATCH 43/52] Revert npx changes --- scripts/angular-tester.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 14bcb609..ebe2f09b 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -114,9 +114,21 @@ function prepareTestDir( version ) { { src: 'scripts/assets/demo-form.component.ts', dest: 'src/app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; + logger.logAction( `Initializing ${chalk.italic( 'package.json' )} file...` ); + execNpmCommand( + `init -y`, + TESTS_PATH + ) + + logger.logAction( `Installing ${chalk.italic( '@angular/cli' )} locally...` ); + execNpmCommand( + `i @angular/cli@${version}`, + TESTS_PATH + ); + logger.logAction( 'Initializing Angular project...' ); execNpxCommand( - `npx ng new cke4-angular-app --skip-git`, + `ng new cke4-angular-app --skip-git`, TESTS_PATH ) From 40479e4dc6a304bd7199cffffabef55cd845be1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 16:51:50 +0200 Subject: [PATCH 44/52] Refactor test utils --- .github/workflows/test-all.yml | 2 +- .travis.yml | 36 ------ e2e/protractor.conf.js | 28 ----- e2e/src/app.e2e-spec.ts | 74 ------------- e2e/src/app.po.ts | 47 -------- e2e/tsconfig.e2e.json | 13 --- package.json | 10 +- scripts/angular-tester.js | 18 ++- scripts/assets/karma.conf.js | 98 ----------------- scripts/{_helpers => helpers}/getVersions.js | 0 scripts/{_helpers => helpers}/logger.js | 0 scripts/{_helpers => helpers}/tools.js | 0 src/karma.conf.js | 109 +++++++------------ 13 files changed, 55 insertions(+), 380 deletions(-) delete mode 100644 .travis.yml delete mode 100644 e2e/protractor.conf.js delete mode 100644 e2e/src/app.e2e-spec.ts delete mode 100644 e2e/src/app.po.ts delete mode 100644 e2e/tsconfig.e2e.json delete mode 100644 scripts/assets/karma.conf.js rename scripts/{_helpers => helpers}/getVersions.js (100%) rename scripts/{_helpers => helpers}/logger.js (100%) rename scripts/{_helpers => helpers}/tools.js (100%) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 26edc9de..0104a2e9 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -66,4 +66,4 @@ jobs: BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }} BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }} with: - run: npm run test:angular-tester -- --angular ${{ env.ANGULAR_VERSION }} --browser ${{ matrix.browser }} + run: npm run test:angular -- --angular ${{ env.ANGULAR_VERSION }} --browser ${{ matrix.browser }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f372de87..00000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -os: linux -dist: xenial - -services: - - xvfb - -addons: - chrome: stable - firefox: latest - -branches: - only: - - master - - major - - stable - - latest - - /^\d+\.\d+(\.\d+)?(-\S*)?$/ - - /^release\/\d+\.\d+\.x$/ - -language: node_js -node_js: - - 12 - -cache: - npm: false - -before_install: - - 'export DISPLAY=:99.0' -install: - - npm install -script: - - ng test && ng e2e -env: - global: - - secure: nbn1MJ/N+shUkYqXqKxzQJw30F8q7XC4LNxuMYuP13deUI1/XzRWh7l6+T37AVQicDoVXbro2ve5hknc5TtGwGJTZnvZRtnGe/vZigj/N/NGYeuiNSNIzNQ9MyqJ0sxvuPEIDhYn5UfXkpweoYFe4Budy4AWvHbeE8KNLfzs4M+YD/Oyi+dyBY+RvWWHYRgfbrc7ZiDoRcx2ZDeYPjs5gWDK0VfG13IIp3YnZIpL8CWjI0+p1BBzTP9eQxtRcumLlxq1Rm7sqtxyyRaFTLgk1eRp/JdPFeRuMsSDTfNNhORTqgNyFeubWIy7LjzxZ6fZr+fLAVUJwncunFnOo6yAV5qe+kvzAepcli43zM9sdJPUn6FRm2fcQtSccW44rHH2HHaaQd0yg0DIbrBB3n6we3kBzyM/N24Y4Z6kU9rpmJvZTcW9GTjfb9zQzhyinsHPfTlNoTPnPc6ae9Kqudc/f7PboThwfML6t+p/beOHsXZfrHaDGRvzwWQrD8VBaUAhEA7ez4aiVmVSaTKY4Or/BJNMj/fkvWsFidFGFHgyOO9k3YE9ibK0tJBTja6UiuqBOG+7IpcfHkArtAeXXvTMS8ON1wUc0HMWSsEVYiNjiLP8rLlnNek5McZT5VondvpqvFzMtU/d3ONL/AQ4XbZSiJetBVQDmzgqgKDcJmW6PZo= - - secure: QHLviMCt0OLmb8mYOdZ2v2Dm/+PRtbOJ6et7C3/tu3Wt0in+RnQap1pXbN9Pz8Vgsd1AbAL5VAmZaKKI6YNLHmdDnHq15piTLYUWInkEIW26ypLas+KJ4II4Az4QWZSimvXgkAogu7dPgH22fAQB+oRQsrw9ZkJWlzEYzl4z2I7hnyH8zkssxwQ7GhjCliiivVEY5jVDSUMV8STH1qOhL1LRDgWSTYPd1qDiJ80KEGKijRyerid85NXVZgIVU94BpRHmNi1bgnE2vUaDkTHv+eY2Cv6W+J2ZhqfMxtoBoqhbDe1gEJjNl79mPP6b61yAJdfDXOcdO+vMmbaj6DYr8H/Hz1O43AeHdjIrkFTIATMstqndlJ88tkiFVFRWWk2iK3PV1gquU11LZjZ/6HK8xVtZRojaODcBcU4RwvCFUYnwKAKM+UVYYEU0vmhR38C1O8U6O4KDrI01TxV6WidgyNGlqDjmPyESNBvJMTsNB75iRsCczn+v1pwLyVLrdrPInDtdXnBh/5LnwbNEFpf9g6L3XQl9HYgfev3O+Ci+6c0Sz4GCvS41vs2afXWmoARSBGFPBLSTtNIMtVJ2VlOXxcOPOPTbpzYjgs8KOqXQvYtYJp0cKWChuerdKBNu5p5/c1l1IDTTfOIdDD1oXvA9FJaCmAEZtU6GJ1in9DjDeSw= diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js deleted file mode 100644 index 440ef8fa..00000000 --- a/e2e/protractor.conf.js +++ /dev/null @@ -1,28 +0,0 @@ -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const { SpecReporter } = require('jasmine-spec-reporter'); - -exports.config = { - allScriptsTimeout: 11000, - specs: [ - './src/**/*.e2e-spec.ts' - ], - capabilities: { - 'browserName': 'chrome' - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function() {} - }, - onPrepare() { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.e2e.json') - }); - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - } -}; diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts deleted file mode 100644 index 524ab33c..00000000 --- a/e2e/src/app.e2e-spec.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -import { AppPage } from './app.po'; -import { protractor, WebElement } from 'protractor'; - -describe( 'workspace-project App', () => { - let page: AppPage, - editables: WebElement[]; - - beforeEach( () => { - page = new AppPage; - } ); - - describe( 'simple-usage', () => { - beforeEach( () => { - page.navigateTo( 'simple-usage' ); - } ); - - beforeEach( async () => { - editables = [ await page.getEditable(), await page.getInlineEditable() ]; - } ); - - it( 'should display welcome message', () => { - expect( page.getParagraphText() ).toEqual( 'CKEditor 4 integration with Angular' ); - } ); - - it( 'should display editor with initial content', () => { - editables.forEach( editable => expect( page.getHtmlString( editable ) ) - .toBe( '

Getting used to an entirely different culture can be challeng' + - 'ing. While it’s also nice to learn about cultures online or from books, nothing comes close to experiencing cultural d' + - 'iversity in person. You learn to appreciate each and every single one of the differences while you become more cultura' + - 'lly fluid.

' ) - ); - } ); - - describe( 'typing', () => { - it( `in editor1 should update editors content`, testTyping( 0 ) ); - it( `in editor2 should update editors content`, testTyping( 1 ) ); - } ); - } ); - - describe( 'demo-forms', () => { - beforeEach( () => { - page.navigateTo( 'forms' ); - } ); - - beforeEach( async () => { - editables = [ await page.getEditable() ]; - } ); - - it( 'should display editor with initial content', () => { - expect( page.getHtmlString( editables[ 0 ] ) ) - .toBe( '

A really nice fellow.

' ); - } ); - - it( `typing should update editor content`, testTyping( 0 ) ); - } ); - - function testTyping( elementIndex: number ) { - return async function() { - const text = 'Foo! Bar?'; - - await page.updateValue( editables[ elementIndex ], text ); - - editables.forEach( item => { - expect( page.getHtmlString( item ) ) - .toBe( '

Foo! Bar?

' ); - } ); - }; - } -} ); diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts deleted file mode 100644 index 88ba5da5..00000000 --- a/e2e/src/app.po.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -import { protractor, browser, by, element, WebElement, ElementFinder } from 'protractor'; - -export class AppPage { - navigateTo( target: string = '' ) { - return browser.get( `/${target}` ); - } - - getParagraphText() { - return element( by.css( 'app-root h1' ) ).getText(); - } - - async waitForElement( el: ElementFinder ) { - return browser.wait( protractor.ExpectedConditions.presenceOf( el ) ).then( () => el ); - } - - async getEditable() { - return this.getElementByCss( '.cke_editable:not(.cke_editable_inline)' ); - } - - async getInlineEditable() { - return this.getElementByCss( '.cke_editable_inline' ); - } - - async getElementByCss( query ) { - const el = await element( by.css( query ) ); - await this.waitForElement( el ); - return el; - } - - async getHtmlString( el: WebElement ) { - return el.getAttribute( 'innerHTML' ); - } - - async updateValue( el: WebElement, text: string ) { - await el.clear(); - await el.click(); - - for ( let i = 0; i < text.length; i++ ) { - await el.sendKeys( text.charAt( i ) ); - } - } -} diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json deleted file mode 100644 index 415179b4..00000000 --- a/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "module": "commonjs", - "target": "es5", - "types": [ - "jasmine", - "jasminewd2", - "node" - ] - } -} \ No newline at end of file diff --git a/package.json b/package.json index 003c4609..3cc01fec 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,9 @@ "start": "ng serve", "build": "ng build", "build-package": "node ./scripts/build-package.js", - "test": "node ./scripts/test.js", - "test:angular-tester": "node ./scripts/angular-tester.js", - "test:all": "npm run test:angular-tester -- --angular all", + "test": "ng test", + "test:angular": "node ./scripts/angular-tester.js", "lint": "ng lint", - "e2e": "ng e2e", "bump": "node ./scripts/bump.js", "publish:dry": "npm publish dist/ --dry-run", "publish": "npm publish dist/", @@ -28,9 +26,6 @@ "url": "https://github.com/ckeditor/ckeditor4-angular.git" }, "private": true, - "dependencies": { - "ckeditor4-integrations-common": "^0.2.0" - }, "devDependencies": { "@angular-devkit/build-angular": "^12.1.2", "@angular/animations": "^12.1.2", @@ -58,7 +53,6 @@ "karma": "^6.3.4", "karma-browserstack-launcher": "1.4.0", "karma-chrome-launcher": "~3.1.0", - "karma-coverage-istanbul-reporter": "~3.0.3", "karma-firefox-launcher": "^2.1.1", "karma-jasmine": "^4.0.1", "karma-jasmine-html-reporter": "^1.7.0", diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index ebe2f09b..5137bfb2 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -10,9 +10,14 @@ const { resolve: resolvePath } = require( 'path' ); const semverMajor = require( 'semver/functions/major' ); const chalk = require( 'chalk' ); -const Logger = require( './_helpers/logger' ); -const getVersions = require( './_helpers/getVersions' ); -const { execNpmCommand, execNpxCommand, rmdirSyncRecursive, copyFiles } = require( './_helpers/tools' ); +const Logger = require( './helpers/logger' ); +const getVersions = require( './helpers/getVersions' ); +const { + execNpmCommand, + execNpxCommand, + rmdirSyncRecursive, + copyFiles +} = require( './helpers/tools' ); /** * @@ -108,8 +113,8 @@ function prepareTestDir( version ) { { src: 'src/app', dest: 'src/app', versions: 'all' }, { src: 'src/ckeditor', dest: 'src/ckeditor', versions: 'all' }, { src: 'src/test.tools.ts', dest: 'src/test.tools.ts', versions: 'all' }, - { src: 'scripts/assets/karma.conf.js', dest: 'src/karma.conf.js', versions: [ 6, 7 ] }, - { src: 'scripts/assets/karma.conf.js', dest: 'karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, + { src: 'src/karma.conf.js', dest: 'src/karma.conf.js', versions: [ 6, 7 ] }, + { src: 'src/karma.conf.js', dest: 'karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, { src: 'scripts/assets/tsconfig.json', dest: 'tsconfig.json', versions: [ 12 ] }, { src: 'scripts/assets/demo-form.component.ts', dest: 'src/app/demo-form/demo-form.component.ts', versions: [ 6, 7 ] } ]; @@ -163,8 +168,11 @@ function prepareTestDir( version ) { */ function testVersion( version ) { try { + process.env.REQUESTED_ANGULAR_VERSION = version; + logger.logHeader( `Testing ${chalk.italic( '@angular/cli@' + version )}` ); logger.logAction( 'Executing tests...' ); + execNpmCommand( `run test -- --browsers ${testedBrowser}`, TEST_APP_PATH diff --git a/scripts/assets/karma.conf.js b/scripts/assets/karma.conf.js deleted file mode 100644 index 0bd305f6..00000000 --- a/scripts/assets/karma.conf.js +++ /dev/null @@ -1,98 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -let options = process.env.KARMA_OPTIONS; -options = options ? JSON.parse(options) : {}; - -module.exports = function (config) { - config.set({ - basePath: "", - frameworks: ["jasmine", "@angular-devkit/build-angular"], - plugins: getPlugins(), - client: { - clearContext: false, // leave Jasmine Spec Runner output visible in browser - captureConsole: false, - jasmine: { - random: false, - }, - }, - coverageIstanbulReporter: { - dir: require("path").join(__dirname, "../coverage"), - reports: ["html", "lcovonly"], - fixWebpackSourcePaths: true, - }, - reporters: ["spec"], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: config.browsers, - singleRun: !options.watch, - - concurrency: 2, - captureTimeout: 60000, - browserDisconnectTimeout: 60000, - browserDisconnectTolerance: 3, - browserNoActivityTimeout: 60000, - - specReporter: { - suppressPassed: true, - suppressErrorSummary: true, - maxLogLines: 8, - }, - - ...(options.url && { files: [options.url] }), - - customLaunchers: { - BrowserStack_Edge: { - base: "BrowserStack", - os: "Windows", - os_version: "10", - browser: "edge", - }, - BrowserStack_IE11: { - base: "BrowserStack", - os: "Windows", - os_version: "10", - browser: "ie", - browser_version: "11.0", - }, - BrowserStack_Safari: { - base: "BrowserStack", - os: "OS X", - os_version: "Big Sur", - browser: "safari", - }, - }, - - browserStack: { - username: process.env.BROWSER_STACK_USERNAME, - accessKey: process.env.BROWSER_STACK_ACCESS_KEY, - build: process.env.BUILD_SLUG, - project: "ckeditor4", - }, - }); -}; - -function getPlugins() { - const plugins = [ - require("karma-jasmine"), - require("karma-chrome-launcher"), - require("karma-firefox-launcher"), - require("@angular-devkit/build-angular/plugins/karma"), - require("karma-spec-reporter"), - ]; - - if (shouldEnableBrowserStack()) { - plugins.push(require("karma-browserstack-launcher")); - } - - return plugins; -} - -function shouldEnableBrowserStack() { - return ( - process.env.BROWSER_STACK_ACCESS_KEY && - process.env.BROWSER_STACK_ACCESS_KEY - ); -} diff --git a/scripts/_helpers/getVersions.js b/scripts/helpers/getVersions.js similarity index 100% rename from scripts/_helpers/getVersions.js rename to scripts/helpers/getVersions.js diff --git a/scripts/_helpers/logger.js b/scripts/helpers/logger.js similarity index 100% rename from scripts/_helpers/logger.js rename to scripts/helpers/logger.js diff --git a/scripts/_helpers/tools.js b/scripts/helpers/tools.js similarity index 100% rename from scripts/_helpers/tools.js rename to scripts/helpers/tools.js diff --git a/src/karma.conf.js b/src/karma.conf.js index a6fcbec3..4d9d163e 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -1,32 +1,40 @@ + // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html let options = process.env.KARMA_OPTIONS; -options = options ? JSON.parse( options ) : {}; +options = options ? JSON.parse(options) : {}; + +const { + // Set via CLI + BROWSER_STACK_USERNAME, + BROWSER_STACK_ACCESS_KEY, + BUILD_SLUG, + // Set by angular-tester script + REQUESTED_ANGULAR_VERSION +} = process.env; module.exports = function ( config ) { - config.set( { + const LOG_INFO = config.LOG_INFO; + const browsers = config.browsers.length === 0 ? [ 'Chrome' ] : config.browsers; + + config.set({ basePath: '', - frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], + frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: getPlugins(), client: { clearContext: false, // leave Jasmine Spec Runner output visible in browser captureConsole: false, jasmine: { - random: false - } - }, - coverageIstanbulReporter: { - dir: require( 'path' ).join( __dirname, '../coverage' ), - reports: [ 'html', 'lcovonly' ], - fixWebpackSourcePaths: true + random: false, + }, }, - reporters: [ 'spec', 'kjhtml' ], + reporters: [ 'spec' ], port: 9876, colors: true, - logLevel: config.LOG_INFO, + logLevel: LOG_INFO, autoWatch: true, - browsers: getBrowsers(), + browsers, singleRun: !options.watch, concurrency: 2, @@ -36,66 +44,51 @@ module.exports = function ( config ) { browserNoActivityTimeout: 60000, specReporter: { - suppressPassed: shouldEnableBrowserStack() + suppressPassed: true, + suppressErrorSummary: true, + maxLogLines: 8, }, - ...( options.url && { files: [ options.url ] } ), + ...(options.url && { files: [options.url] }), customLaunchers: { BrowserStack_Edge: { base: 'BrowserStack', os: 'Windows', os_version: '10', - browser: 'edge' + browser: 'edge', }, BrowserStack_IE11: { base: 'BrowserStack', os: 'Windows', os_version: '10', browser: 'ie', - browser_version: '11.0' + browser_version: '11.0', }, BrowserStack_Safari: { base: 'BrowserStack', os: 'OS X', os_version: 'Big Sur', - browser: 'safari' - } + browser: 'safari', + }, }, browserStack: { - username: process.env.BROWSER_STACK_USERNAME, - accessKey: process.env.BROWSER_STACK_ACCESS_KEY, - build: getBuildName(), - project: 'ckeditor4' + username: BROWSER_STACK_USERNAME, + accessKey: BROWSER_STACK_ACCESS_KEY, + build: BUILD_SLUG || 'ckeditor4-angular local', + name: `${ browsers[ 0 ]} - Angular ${ REQUESTED_ANGULAR_VERSION }`, + project: 'ckeditor4', }, - } ); + }); }; -// Formats name of the build for BrowserStack. It merges a repository name and current timestamp. -// If env variable `TRAVIS_REPO_SLUG` is not available, the function returns `undefined`. -// -// @returns {String|undefined} -function getBuildName() { - const repoSlug = process.env.TRAVIS_REPO_SLUG; - - if ( !repoSlug ) { - return; - } - - const repositoryName = repoSlug.split( '/' )[ 1 ].replace( /-/g, '_' ); - const date = new Date().getTime(); - - return `${ repositoryName } ${ date }`; -} - function getPlugins() { const plugins = [ require( 'karma-jasmine' ), require( 'karma-chrome-launcher' ), require( 'karma-firefox-launcher' ), require( 'karma-jasmine-html-reporter' ), - require( 'karma-coverage-istanbul-reporter' ), require( '@angular-devkit/build-angular/plugins/karma' ), require( 'karma-spec-reporter' ) ]; @@ -109,33 +102,9 @@ function getPlugins() { return plugins; } -function getBrowsers() { - if ( shouldEnableBrowserStack() ) { - return [ - 'Chrome', - 'BrowserStack_Safari', - 'Firefox', - 'BrowserStack_Edge', - 'BrowserStack_IE11' - ]; - } - - return [ - 'Chrome', - 'Firefox' - ]; -} - function shouldEnableBrowserStack() { - if ( !process.env.BROWSER_STACK_USERNAME ) { - return false; - } - - if ( !process.env.BROWSER_STACK_ACCESS_KEY ) { - return false; - } - - // If the repository slugs are different, the pull request comes from the community (forked repository). - // For such builds, BrowserStack will be disabled. Read more: https://github.com/ckeditor/ckeditor5-dev/issues/358. - return ( process.env.TRAVIS_EVENT_TYPE !== 'pull_request' || process.env.TRAVIS_PULL_REQUEST_SLUG === process.env.TRAVIS_REPO_SLUG ); + return ( + process.env.BROWSER_STACK_ACCESS_KEY && + process.env.BROWSER_STACK_ACCESS_KEY + ); } From 25da4b6be38c9c03902cd41954d564be63e58cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 16:53:08 +0200 Subject: [PATCH 45/52] Remove integrations common --- package-lock.json | 442 +++++++++++++++++++++------------------------- 1 file changed, 200 insertions(+), 242 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5e7593e..421bcbeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2994,12 +2994,28 @@ "tweetnacl": "^0.14.3" } }, + "big-integer": { + "version": "1.6.48", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", + "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", + "dev": true + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "dev": true }, + "binary": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", + "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", + "dev": true, + "requires": { + "buffers": "~0.1.1", + "chainsaw": "~0.1.0" + } + }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -3036,6 +3052,12 @@ "minimist": "^1.2.0" } }, + "bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", + "dev": true + }, "body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -3168,32 +3190,42 @@ } } }, - "browserstack-local": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/browserstack-local/-/browserstack-local-1.4.8.tgz", - "integrity": "sha512-s+mc3gTOJwELdLWi4qFVKtGwMbb5JWsR+JxKlMaJkRJxoZ0gg3WREgPxAN0bm6iU5+S4Bi0sz0oxBRZT8BiNsQ==", + "browserstacktunnel-wrapper": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/browserstacktunnel-wrapper/-/browserstacktunnel-wrapper-2.0.4.tgz", + "integrity": "sha512-GCV599FUUxNOCFl3WgPnfc5dcqq9XTmMXoxWpqkvmk0R9TOIoqmjENNU6LY6DtgIL6WfBVbg/jmWtnM5K6UYSg==", "dev": true, "requires": { - "https-proxy-agent": "^4.0.0", - "is-running": "^2.1.0", - "ps-tree": "=1.2.0", - "temp-fs": "^0.9.9" + "https-proxy-agent": "^2.2.1", + "unzipper": "^0.9.3" }, "dependencies": { "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } }, "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", "dev": true, "requires": { - "agent-base": "5", - "debug": "4" + "agent-base": "^4.3.0", + "debug": "^3.1.0" } } } @@ -3220,6 +3252,18 @@ "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", "dev": true }, + "buffer-indexof-polyfill": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", + "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", + "dev": true + }, + "buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", + "dev": true + }, "builtin-modules": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", @@ -3332,6 +3376,15 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, + "chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", + "dev": true, + "requires": { + "traverse": ">=0.3.0 <0.4" + } + }, "chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", @@ -3408,14 +3461,6 @@ "integrity": "sha512-g38K9Cm5WRwlaH6g03B9OEz/0qRizI+2I7n+Gz+L5DxXJAPAiWQvwlYNm1V1jkdpUv95bOe/ASm2vfi/G560jQ==", "dev": true }, - "ckeditor4-integrations-common": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/ckeditor4-integrations-common/-/ckeditor4-integrations-common-0.2.0.tgz", - "integrity": "sha512-KkHztF0bkGOnTcifWFd55j5Y9SCR3uk12SGgS6L1mZNnBeIJFCcgTwZWEHtG2aDJF7aZob7cex1CShL+SrNuow==", - "requires": { - "load-script": "^1.0.0" - } - }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -4801,11 +4846,40 @@ "domhandler": "^4.2.0" } }, - "duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } }, "ecc-jsbn": { "version": "0.1.2", @@ -5064,21 +5138,6 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, - "event-stream": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", - "dev": true, - "requires": { - "duplexer": "~0.1.1", - "from": "~0", - "map-stream": "~0.1.0", - "pause-stream": "0.0.11", - "split": "0.3", - "stream-combiner": "~0.0.4", - "through": "~2.3.1" - } - }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -5536,12 +5595,6 @@ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", "dev": true }, - "from": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", - "dev": true - }, "fs-extra": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", @@ -5581,6 +5634,38 @@ "dev": true, "optional": true }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -5931,12 +6016,6 @@ "integrity": "sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA==", "dev": true }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -6686,12 +6765,6 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, - "is-running": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-running/-/is-running-2.1.0.tgz", - "integrity": "sha1-MKc/9cw4VOT8JUkICen1q/jeCeA=", - "dev": true - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -6787,102 +6860,6 @@ } } }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", - "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", - "source-map": "^0.6.1" - }, - "dependencies": { - "istanbul-lib-coverage": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", - "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", - "dev": true - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, "jasmine": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz", @@ -7238,13 +7215,13 @@ } }, "karma-browserstack-launcher": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-1.6.0.tgz", - "integrity": "sha512-Y/UWPdHZkHIVH2To4GWHCTzmrsB6H7PBWy6pw+TWz5sr4HW2mcE+Uj6qWgoVNxvQU1Pfn5LQQzI6EQ65p8QbiQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-1.4.0.tgz", + "integrity": "sha512-bUQK84U+euDfOUfEjcF4IareySMOBNRLrrl9q6cttIe8f011Ir6olLITTYMOJDcGY58wiFIdhPHSPd9Pi6+NfQ==", "dev": true, "requires": { "browserstack": "~1.5.1", - "browserstack-local": "^1.3.7", + "browserstacktunnel-wrapper": "~2.0.2", "q": "~1.5.0" } }, @@ -7257,19 +7234,6 @@ "which": "^1.2.1" } }, - "karma-coverage-istanbul-reporter": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-3.0.3.tgz", - "integrity": "sha512-wE4VFhG/QZv2Y4CdAYWDbMmcAHeS926ZIji4z+FkB2aF/EposRb6DP6G5ncT/wXhqUfAb/d7kZrNKPonbvsATw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^3.0.6", - "istanbul-reports": "^3.0.2", - "minimatch": "^3.0.4" - } - }, "karma-firefox-launcher": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.1.tgz", @@ -7434,10 +7398,11 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, - "load-script": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/load-script/-/load-script-1.0.0.tgz", - "integrity": "sha1-BJGTngvuVkPuSUp+PaPSuscMbKQ=" + "listenercount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", + "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", + "dev": true }, "loader-runner": { "version": "4.2.0", @@ -7649,12 +7614,6 @@ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", "dev": true }, - "map-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", - "dev": true - }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -8793,15 +8752,6 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, - "pause-stream": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", - "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", - "dev": true, - "requires": { - "through": "~2.3" - } - }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -11441,15 +11391,6 @@ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, - "ps-tree": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", - "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", - "dev": true, - "requires": { - "event-stream": "=3.3.4" - } - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -12325,6 +12266,12 @@ } } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, "setprototypeof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", @@ -12712,15 +12659,6 @@ "wbuf": "^1.7.3" } }, - "split": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", - "dev": true, - "requires": { - "through": "2" - } - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -12795,15 +12733,6 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "dev": true }, - "stream-combiner": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", - "dev": true, - "requires": { - "duplexer": "~0.1.1" - } - }, "streamroller": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", @@ -13090,26 +13019,6 @@ "yallist": "^4.0.0" } }, - "temp-fs": { - "version": "0.9.9", - "resolved": "https://registry.npmjs.org/temp-fs/-/temp-fs-0.9.9.tgz", - "integrity": "sha1-gHFzBDeHByDpQxUy/igUNk+IA9c=", - "dev": true, - "requires": { - "rimraf": "~2.5.2" - }, - "dependencies": { - "rimraf": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.4.tgz", - "integrity": "sha1-loAAk8vxoMhr2VtGJUZ1NcKd+gQ=", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - } - } - }, "terser": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz", @@ -13250,6 +13159,12 @@ "punycode": "^2.1.1" } }, + "traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", + "dev": true + }, "tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -13532,6 +13447,49 @@ } } }, + "unzipper": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.9.15.tgz", + "integrity": "sha512-2aaUvO4RAeHDvOCuEtth7jrHFaCKTSXPqUkXwADaLBzGbgZGzUDccoEdJ5lW+3RmfpOZYNx0Rw6F6PUzM6caIA==", + "dev": true, + "requires": { + "big-integer": "^1.6.17", + "binary": "~0.3.0", + "bluebird": "~3.4.1", + "buffer-indexof-polyfill": "~1.0.0", + "duplexer2": "~0.1.4", + "fstream": "^1.0.12", + "listenercount": "~1.0.1", + "readable-stream": "~2.3.6", + "setimmediate": "~1.0.4" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", From 9a8c11b26c67e5c70627bd47d5eea14b8fc89452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Tue, 3 Aug 2021 16:59:31 +0200 Subject: [PATCH 46/52] Remove unnecessary test script --- scripts/test.js | 56 ------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 scripts/test.js diff --git a/scripts/test.js b/scripts/test.js deleted file mode 100644 index aeba2a4d..00000000 --- a/scripts/test.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -'use strict'; - -// This script is a workaround for Angular CLI not allowing to run tests with custom options. -// Manually running `karma start ./src/karma.conf.js` doesn't work either. -// Some of the plugins check if test is run by Angular CLI, and if not, they throw errors. -// https://github.com/angular/angular-cli/issues/12305 - -const minimist = require( 'minimist' ); -const { spawn } = require( 'child_process' ); -const options = parseArguments( process.argv.slice( 2 ) ); -const env = Object.create( process.env ); - -env.KARMA_OPTIONS = JSON.stringify( options ); - -spawn( 'ng', [ 'test' ], { - stdio: 'inherit', // Pass parent's stdio's to child. Without that option no logs will be visible. - env -} ); - -/** - * @param {Array.} args CLI arguments and options. - * @returns {Object} options - * @returns {Boolean} options.url The `ckeditor.js` url to be included by karma. - * @returns {Boolean} options.watch Whether to watch the files for changes. - */ -function parseArguments( args ) { - const config = { - string: [ - 'url' - ], - - boolean: [ - 'watch' - ], - - alias: { - u: 'url', - w: 'watch' - } - }; - - const options = minimist( args, config ); - - // Delete all aliases because we don't want to use them in the code. - // They are useful when calling command but useless after that. - for ( const alias of Object.keys( config.alias ) ) { - delete options[ alias ]; - } - - return options; -} From e96891a57bc677a6516aa07f9d041cd92f118803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 15:37:50 +0200 Subject: [PATCH 47/52] Add ckeditor4-integrations-common to dev deps --- package-lock.json | 6 ++++++ package.json | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 421bcbeb..c7f78d73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3461,6 +3461,12 @@ "integrity": "sha512-g38K9Cm5WRwlaH6g03B9OEz/0qRizI+2I7n+Gz+L5DxXJAPAiWQvwlYNm1V1jkdpUv95bOe/ASm2vfi/G560jQ==", "dev": true }, + "ckeditor4-integrations-common": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ckeditor4-integrations-common/-/ckeditor4-integrations-common-1.0.0.tgz", + "integrity": "sha512-OAoQT/gYrHkg0qgzf6MS/rndYhq3SScLVQ3rtXQeuCE8ju7nFHg3qZ7WGA2XpFxcZzsMP6hhugXqdel5vbcC3g==", + "dev": true + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", diff --git a/package.json b/package.json index 3cc01fec..50547418 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@types/node": "^16.3.2", "browserslist": "^4.16.6", "chalk": "^4.1.1", + "ckeditor4-integrations-common": "^1.0.0", "classlist.js": "^1.1.20150312", "codelyzer": "^6.0.2", "core-js": "^3.15.2", @@ -57,13 +58,13 @@ "karma-jasmine": "^4.0.1", "karma-jasmine-html-reporter": "^1.7.0", "karma-spec-reporter": "0.0.32", + "minimist": "^1.2.5", "ng-packagr": "^12.1.2", + "protractor": "~7.0.0", "rxjs": "^7.2.0", + "semver": "^7.3.5", "ts-node": "^10.1.0", "tslib": "^2.3.0", - "minimist": "^1.2.5", - "protractor": "~7.0.0", - "semver": "^7.3.5", "tslint": "^6.1.3", "typescript": "^4.3.5", "wait-until-promise": "^1.0.0", From 9b01535693cb523b5b03921f235d6ea12fee52d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 15:38:16 +0200 Subject: [PATCH 48/52] Do not use next channel --- scripts/helpers/getVersions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/helpers/getVersions.js b/scripts/helpers/getVersions.js index 5c4d2f62..64eeacd8 100644 --- a/scripts/helpers/getVersions.js +++ b/scripts/helpers/getVersions.js @@ -36,7 +36,9 @@ function getImportantVersions() { const commandResult = execNpmCommand( 'view @angular/cli dist-tags --json' ); const versions = JSON.parse( commandResult ); - return Object.values( versions ); + return Object.keys( versions ) + .filter( key => key !== 'next' ) + .map( key => versions[ key ] ); } From 12d84e814f9ee202450ce212b874c9f468ffb819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 15:38:35 +0200 Subject: [PATCH 49/52] Adjust config for BrowserStack --- src/karma.conf.js | 70 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/karma.conf.js b/src/karma.conf.js index 4d9d163e..c7968a1f 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -1,47 +1,59 @@ - // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html let options = process.env.KARMA_OPTIONS; -options = options ? JSON.parse(options) : {}; +options = options ? JSON.parse( options ) : {}; +// Following environment variables must be set if BrowserStack is used. +// Omit them if locally installed browsers are used. const { // Set via CLI BROWSER_STACK_USERNAME, BROWSER_STACK_ACCESS_KEY, BUILD_SLUG, - // Set by angular-tester script - REQUESTED_ANGULAR_VERSION + + // Set by scripts/angular-tester.js + REQUESTED_ANGULAR_VERSION, } = process.env; module.exports = function ( config ) { const LOG_INFO = config.LOG_INFO; + + // Browsers are controlled via CLI, e.g.: + // + // `npm test -- --browsers Firefox` + // + // Defaults to locally installed Chrome. const browsers = config.browsers.length === 0 ? [ 'Chrome' ] : config.browsers; config.set({ basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], + + frameworks: [ 'jasmine', '@angular-devkit/build-angular' ], + plugins: getPlugins(), + client: { - clearContext: false, // leave Jasmine Spec Runner output visible in browser + // leave Jasmine Spec Runner output visible in browser + clearContext: false, captureConsole: false, jasmine: { random: false, }, }, + reporters: [ 'spec' ], + port: 9876, + colors: true, + logLevel: LOG_INFO, - autoWatch: true, + browsers, - singleRun: !options.watch, - concurrency: 2, - captureTimeout: 60000, - browserDisconnectTimeout: 60000, - browserDisconnectTolerance: 3, - browserNoActivityTimeout: 60000, + // Makes sure to disable watch mode for BrowserStack. + singleRun: shouldEnableBrowserStack() ? true : !options.watch, specReporter: { suppressPassed: true, @@ -49,8 +61,14 @@ module.exports = function ( config ) { maxLogLines: 8, }, - ...(options.url && { files: [options.url] }), + ...( options.url && { files: [ options.url ] } ), + // Makes sure that BrowserStack tests end properly. + browserDisconnectTimeout: 3 * 60 * 1000, + browserDisconnectTolerance: 1, + browserNoActivityTimeout: 3 * 60 * 1000, + + // Configures BrowserStack browsers. customLaunchers: { BrowserStack_Edge: { base: 'BrowserStack', @@ -73,12 +91,26 @@ module.exports = function ( config ) { }, }, + // Configures BrowserStack options. browserStack: { + + // Secret values that can be found on BS dashboard. username: BROWSER_STACK_USERNAME, accessKey: BROWSER_STACK_ACCESS_KEY, + + // Name that will be displayed for a group of tests. + // This value should be unique, especially for CI tests. Commit SHA or timestamp should be used. build: BUILD_SLUG || 'ckeditor4-angular local', - name: `${ browsers[ 0 ]} - Angular ${ REQUESTED_ANGULAR_VERSION }`, + + // Name that will be displayed for a given test suite. + // It should uniquely identify a test suite. + name: `${ browsers[ 0 ] } - Angular ${ REQUESTED_ANGULAR_VERSION }`, + + // Bounds tests to a given project on BS. project: 'ckeditor4', + + // Disablees video recording. + video: false, }, }); }; @@ -90,13 +122,11 @@ function getPlugins() { require( 'karma-firefox-launcher' ), require( 'karma-jasmine-html-reporter' ), require( '@angular-devkit/build-angular/plugins/karma' ), - require( 'karma-spec-reporter' ) + require( 'karma-spec-reporter' ), ]; if ( shouldEnableBrowserStack() ) { - plugins.push( - require( 'karma-browserstack-launcher' ) - ); + plugins.push(require('karma-browserstack-launcher')); } return plugins; @@ -105,6 +135,6 @@ function getPlugins() { function shouldEnableBrowserStack() { return ( process.env.BROWSER_STACK_ACCESS_KEY && - process.env.BROWSER_STACK_ACCESS_KEY + process.env.BROWSER_STACK_USERNAME ); } From d64a29d986bfce0341d6787caa3ca6d810b4d099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 16:25:56 +0200 Subject: [PATCH 50/52] Adjust karma config --- scripts/angular-tester.js | 2 +- src/karma.conf.js | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 5137bfb2..7fef0948 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -139,7 +139,7 @@ function prepareTestDir( version ) { logger.logAction( 'Installing other required packages...' ); execNpmCommand( - `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter karma-browserstack-launcher`, + `i ckeditor4-integrations-common wait-until-promise karma-firefox-launcher karma-spec-reporter karma-browserstack-launcher@1.4.0`, TEST_APP_PATH ); diff --git a/src/karma.conf.js b/src/karma.conf.js index c7968a1f..e4239541 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -21,7 +21,7 @@ module.exports = function ( config ) { // Browsers are controlled via CLI, e.g.: // - // `npm test -- --browsers Firefox` + // `npm test -- --browsers Chrome` // // Defaults to locally installed Chrome. const browsers = config.browsers.length === 0 ? [ 'Chrome' ] : config.browsers; @@ -34,7 +34,7 @@ module.exports = function ( config ) { plugins: getPlugins(), client: { - // leave Jasmine Spec Runner output visible in browser + // Leaves Jasmine Spec Runner output visible in browser. clearContext: false, captureConsole: false, jasmine: { @@ -108,9 +108,6 @@ module.exports = function ( config ) { // Bounds tests to a given project on BS. project: 'ckeditor4', - - // Disablees video recording. - video: false, }, }); }; From df83732c20e2f52c07036dda4dab1361c388efeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 16:26:54 +0200 Subject: [PATCH 51/52] Do not expect drop event to have been called --- src/ckeditor/ckeditor.component.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ckeditor/ckeditor.component.spec.ts b/src/ckeditor/ckeditor.component.spec.ts index 5e9ff598..5914a04b 100644 --- a/src/ckeditor/ckeditor.component.spec.ts +++ b/src/ckeditor/ckeditor.component.spec.ts @@ -388,9 +388,10 @@ describe( 'CKEditorComponent', () => { expect( spyDragEnd ).toHaveBeenCalledTimes( 1 ); - // There is some issue in Firefox with simulating drag-drop flow. The drop event - // is not fired making this assertion fail. Let's skip it for now. - if ( !CKEDITOR.env.gecko ) { + // There are some issues in Firefox and Safari with simulating drag-drop flow. + // The drop event is not firing thus making this assertion to fail. + // Let's skip it for now. + if ( !CKEDITOR.env.gecko && !CKEDITOR.env.safari ) { fireDragEvent( 'drop', component.instance, dropEvent ); expect( spyDrop ).toHaveBeenCalledTimes( 1 ); From efaf66c78cbeff9edb4289d3a2989f5a5474f7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Malik?= Date: Wed, 18 Aug 2021 17:41:12 +0200 Subject: [PATCH 52/52] Adjust test env for IE11 --- package.json | 8 +------- scripts/angular-tester.js | 8 +++++--- scripts/assets/tsconfig.json | 2 +- src/karma.conf.js | 1 - tsconfig.json | 5 +---- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 32050bdb..a7795937 100644 --- a/package.json +++ b/package.json @@ -69,11 +69,5 @@ "typescript": "^4.3.5", "wait-until-promise": "^1.0.0", "zone.js": "^0.11.4" - }, - "browserslist": [ - "> 0.5%", - "last 2 versions", - "Firefox ESR", - "IE 11" - ] + } } diff --git a/scripts/angular-tester.js b/scripts/angular-tester.js index 7fef0948..98131902 100644 --- a/scripts/angular-tester.js +++ b/scripts/angular-tester.js @@ -25,9 +25,10 @@ const { * * Commands: * - * --browser Specifies environment to test. - * Possible values: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11'. - * Defaults to: 'Chrome'. + * --browser Specifies environment to test. + * Specify browser name, e.g.: 'Chrome', 'Firefox', 'BrowserStack_Safari', 'BrowserStack_Edge', 'BrowserStack_IE11'. + * Defaults to: 'Chrome'. + * * --angular Specifies Angular version to test. Possible values: 'all', 'current' or specific version. Defaults to: 'current'. * */ @@ -113,6 +114,7 @@ function prepareTestDir( version ) { { src: 'src/app', dest: 'src/app', versions: 'all' }, { src: 'src/ckeditor', dest: 'src/ckeditor', versions: 'all' }, { src: 'src/test.tools.ts', dest: 'src/test.tools.ts', versions: 'all' }, + { src: 'src/polyfills.ts', dest: 'src/polyfills.ts', versions: 'all' }, { src: 'src/karma.conf.js', dest: 'src/karma.conf.js', versions: [ 6, 7 ] }, { src: 'src/karma.conf.js', dest: 'karma.conf.js', versions: [ 8, 9, 10, 11, 12 ] }, { src: 'scripts/assets/tsconfig.json', dest: 'tsconfig.json', versions: [ 12 ] }, diff --git a/scripts/assets/tsconfig.json b/scripts/assets/tsconfig.json index deb9ca6e..fd7ae8db 100644 --- a/scripts/assets/tsconfig.json +++ b/scripts/assets/tsconfig.json @@ -13,7 +13,7 @@ "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, - "target": "es2017", + "target": "es5", "module": "es2020", "lib": [ "es2018", diff --git a/src/karma.conf.js b/src/karma.conf.js index e4239541..084d3c94 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -81,7 +81,6 @@ module.exports = function ( config ) { os: 'Windows', os_version: '10', browser: 'ie', - browser_version: '11.0', }, BrowserStack_Safari: { base: 'BrowserStack', diff --git a/tsconfig.json b/tsconfig.json index e8d90a7a..343f21cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,9 +12,6 @@ }, { "path": "./src/tsconfig.spec.json" - }, - { - "path": "./e2e/tsconfig.e2e.json" } ] -} \ No newline at end of file +}