Testing environment for CKEditor 5. It's based on Karma and webpack and it's normally used in the CKEditor 5 development environment. Read more about CKEditor 5's testing environment.
More information about development tools packages can be found at the following URL: https://github.com/ckeditor/ckeditor5-dev.
First, you need to install the package:
npm i --save-dev @ckeditor/ckeditor5-dev-tests
An example npm task to test CKEditor 5 packages (used e.g. in https://github.com/ckeditor/ckeditor5) can look like this:
{
"scripts": {
"test": "node ./node_modules/.bin/ckeditor5-dev-tests-run-automated",
"manual": "node ./node_modules/.bin/ckeditor5-dev-tests-run-manual"
}
}
If you encounter problems with big test folders pass --max_old_space_size=4096
option to node runner:
{
"scripts": {
"test": "node --max_old_space_size=4096 ./node_modules/.bin/ckeditor5-dev-tests-run-automated"
}
}
You can also use the bin script for testing a package:
# For running all the tests (for the current package and all dependencies).
./node_modules/.bin/ckeditor5-dev-tests --files=*
# For running tests in the current package.
./node_modules/.bin/ckeditor5-dev-tests
-
browsers
- Browsers which will be used to run the tests. Also available as an alias:-b
. -
coverage
- Whether to generate code coverage. Also available as an alias:-c
. -
debug
- Allows specifying custom debug flags. For example, the--debug engine
option uncomments the// @if CK_DEBUG_ENGINE //
lines in the code. By default--debug
is set to true even if you did not specify it. This enables the base set of debug logs (// @if CK_DEBUG //
) which should always be enabled in the testing environment. You can completely turn off the debug mode by setting the--debug false
option or--no-debug
. -
files
- Package names, directories or files to tests. Also available as an alias:-f
. Read more about this option in the Rules for using the--files
option section. -
language
– Specifies a language that will be used while building tests. By default it isen
. -
production
- Run strictest set of checks. E.g. it fails test run when there are console calls or DOM leaks. -
repositories
(-r
) - Specifies names of repositories containing packages that should be tested. Those repositories should be cloned into theexternal/
directory in the root directory of the project. It's a shortcut of the--files
option as these repository packages' names will be read by the tool automatically. -
reporter
- Mocha reporter – eithermocha
(default) ordots
(less verbose one). -
server
- Whether to run the server without opening any browser. -
source-map
- Whether to generate the source maps. Also available as an alias:-s
. -
verbose
- Whether to informs about Webpack's work. Also available as an alias:-v
. -
watch
- Whether to watch the files and executing tests whenever any file changes. Also available as an alias:-w
.
Test the ckeditor5-enter
and ckeditor5-paragraph
packages and generate code coverage report:
$ npm t -- -c --files=enter,paragraph
Run tests/view/**/*.js
tests from ckeditor5-engine
and rerun them once any file change (the watch mode):
$ npm t -- -w --files=engine/view/
Test specified files in ckeditor5-basic-styles
on two browsers (Chrome and Firefox):
$ npm t -- --browsers=Chrome,Firefox --files=basic-styles/bold,basic-styles/italic
Test all installed packages:
$ npm t -- --files=*
Test all installed packages except one (or more):
$ npm t -- --files='!(engine)'
$ npm t -- --files='!(engine|ui)'
The CKEditor 5 can be integrated with IDEs via integrations.
Currently only the IntelliJ based IDEs are supported (WebStorm, PHPStorm, etc). Detailed information are provided in bin/intellijkarmarunner/README.md
.
See the CHANGELOG.md
file.
Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md
file.