-
Notifications
You must be signed in to change notification settings - Fork 12
Testing
⚠⚠ ⚠⚠ ⚠⚠
This wiki served in the early days of CKEditor 5 development and can be severely outdated.
Refer to the official CKEditor 5 documentation for up-to-date information.
Testing in CKEditor 5 is based on Bender.js.
These are some of our goals:
- Code merged into the main development branches (e.g. master) must have tests.
- 100% code coverage for the editor (including branches) and ideally above 80% code coverage for development tasks.
- Reduce the time spent on manual tests to the very minimum. This is achieved either by automation or by proper use of Bender’s manual tests feature.
- Mocha as the test framework.
- Chai, in the expect() flavor, as the assertion library.
- Sinon.JS for spying and stubbing.
When it comes to tests, the following is an example of directories and files that should be present in all projects:
ckeditor5-<something>/
src/ -> Main source code.
tests/ -> Test files.
However, most packages will not be able to run their tests by themselves due to the building process being centralized in the main CKEditor 5 development repository. Therefore, testing must be performed by installing a concrete package as a ckeditor5
dependency (see Development Workflow) and running tests from there.
The ckeditor5
repository has the following structure for tests:
ckeditor5/
src/ -> Main source code.
tests/ -> Test files.
bender.js -> Bender.js configuration file.
package.json -> Having a devDependency to Bender.js.
The building process moves all source and test files from the main repo and all installed dependencies to the dist/
directory. Bender.js then reads all test files from there, what means that after changing any file, the editor must be rebuilt. This can be done automatically by running the builder in the watch mode:
gulp build --watch