Nostalgic Pickled Mango

    @ckeditor/ckeditor5-dev-tests

    30.4.0 • Public • Published

    CKEditor 5 testing environment

    npm version Build Status Dependency Status

    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.

    Usage

    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",
          "manual": "node ./node_modules/.bin/ckeditor5-dev-tests-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"
      }
    }

    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

    CLI options

    • 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.
    • language – Specifies a language that will be used while building tests. By default it is en.
    • 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 the external/ 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 – either mocha (default) or dots (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.

    Examples

    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) you can use:

    $ npm t -- --browsers=Chrome,Firefox --files=basic-styles/boldengine.js,basic
    -styles/italicengine.js

    Test all installed packages:

    $ npm t -- --files=*

    Test all installed packages except one (or more):

    $ npm t -- --files='!(engine)'
    $ npm t -- --files='!(engine|ui)'

    Rules for converting --files option to glob pattern:

    --file Glob Description
    engine node_modules/ckeditor5-engine/tests/**/*.js
    engine/view node_modules/ckeditor5-engine/tests/view/**/*.js
    engine/view/so/**/me/glob.js node_modules/ckeditor5-engine/tests/view/so/**/me/*glob.js
    !(engine) node_modules/ckeditor5-!(engine)*/tests/**/*.js all tests except of given package(s) – works with multiple names `!(engine
    * node_modules/ckeditor5-*/tests/**/*.js all installed package's tests
    ckeditor5 tests/**/*.js tests from the main repository

    IDE integrations

    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.

    Changelog

    See the CHANGELOG.md file.

    License

    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.

    Keywords

    none

    Install

    npm i @ckeditor/ckeditor5-dev-tests

    DownloadsWeekly Downloads

    362

    Version

    30.4.0

    License

    GPL-2.0-or-later

    Unpacked Size

    114 kB

    Total Files

    38

    Last publish

    Collaborators

    • ckeditor