This package has been deprecated

    Author message:

    This package has been deprecated.Package is no longer supported. Use at your own risk.


    2.11.0 • Public • Published


    bb-test - Command line tool for source code analysis (lint), and unit testing


    bb-test [--help] [-v|--version]
    bb-test lint [--help] [-f|--format <format>] [-o|--output <file>]
        [-c|--eslint-config <config file>] [-x --exclude <node glob>] [src]
    bb-test unit [--help] [--prebuilt <paths>] [--load-prebuilt <names>]
        [-x --exclude <node glob>] [--exclude-defaults] [-b|--build-plugins <file|node_modules>]
        [-t|--test-plugins <plugin-list>] [--karma-plugins <plugin-list>] [--disable-karma-plugins]
        [-f|--format <format>] [-B|--browsers <browsers>] [--coverage <reporters>]
        [-w|--watch] [sources...]


    Option Description
    -v, --version output the version number
    --help Output usage information



    bb-test lint - Run eslint and report javascript lint errors


    bb-test lint [--help] [-f|--format <format>] [-o|--output <file>]
        [-c|--eslint-config <config file>] [-x --exclude <node glob>] [src]


    By default bb-test lint uses the @backbase/eslint-config-backbase package for the linting rules. These rules are strongly based on the airbnb es6 rules.

    If you specify a custom eslint config file, it's recommended to extend from @backbase/eslint-config-backbase rules.


    Option Description
    -f, --format <format> Use a specific output format
    -o, --output <file> Specify output file to write report to
    -c, --eslint-config <config file> Custom eslint configuration file
    -x --exclude <node glob> Comma separated paths/globs to ignore. Make sure to wrap globs in single quotes to avoid shell expansion
    --help Output usage information


    Lint all javascript files in the current directory:

      $ bb-test lint

    Lint all javascript files in a sub directory (single quotes to avoid bash expansion):

      $ bb-test lint 'src/**/*.js'

    Lint using a custom config file:

      $ bb-test lint --eslint-config ./eslint.conf.json

    Exclude custom glob patterns from linting:

      $ bb-test lint --exclude 'prebuilt/*,assets/*'


    bb-test unit - Run unit tests for CXP items


    bb-test unit [--help] [--prebuilt <paths>] [--load-prebuilt <names>]
        [-x --exclude <node glob>] [--exclude-defaults] [-b|--build-plugins <file|node_modules>]
        [-t|--test-plugins <plugin-list>] [--karma-plugins <plugin-list>] [--disable-karma-plugins]
        [-f|--format <format>] [-B|--browsers <browsers>] [--coverage <reporters>]
        [-w|--watch] [sources...]


    By default the tests are run in chrome via karma (with webpack) using jasmine.

    bb-test unit works in a similar way to bb-package. It will look for all the sources that need to be tested in the current directory (by default). It will also load any prebuilt dependencies in node_modules or target/backbase (by default).


    Option Description
    --prebuilt <paths> Comma separated paths to prebuilt items (items that don't require a webpack build). These will be merged with the defaults.
    --load-prebuilt <names> Comma separated list of prebuilt items to load in the browser. This is useful if your tests require a global thatis provided by a prebuilt item.
    -x --exclude <node glob> Comma separated paths/globs to ignore. Make sure to wrap globs in single quotes to avoid shell expansion. The exclude glob is evaluated relative to each source directory provided. This exclude is applied the same way as bb-package. It shouldn't be used to exclude certain files from testing, but for excluding entire Backbase itemsfrom being found for testing.
    --exclude-defaults Exclude prebuilt defaults
    -b, --build-plugins <file|node_modules> Comma separated path/node modules to use for the build process
    -t, --test-plugins <plugin-list> Comma separated path/node modules to use for unit testing
    --karma-plugins <plugin-list> Comma separated names of karma plugins to use for unit testing. If not set, all sibling plugins starting with karma-* will be loaded
    --disable-karma-plugins Disable auto-loading of karma-* plugins
    -f, --format <format> Comma separated list of output formats. Possible values (without plugins): dots,progress
    -B, --browsers <browsers> Browser to launch, by default karma is using a Chrome launcher. In order to launch a browser you must have the karma launcher installed (ignore peer dependency warnings)
    --coverage [reporters] Comma separated list of coverage reporters. Possible values: text-summary,html,lcov. Reports will be created in "reports" dir.
    -w, --watch Watch files and re-run tests on changes
    --help Output usage information


    All karma plugins are automatically loaded. Karma plugins are npm packages that are installed as peers to bb-test, and begin with 'karma-'.


    Chrome is the default launcher used, but there is support for any karma launcher.

    Because karma plugins are loaded automatically, just install the correct plugin for the browser you want to launch. For example, you can install the Firefox Launcher and run bb-test unit with --browsers=Firefox. Make sure to consult the launchers documentation for the correct name of the browser.

    It can also accept a comma separated list of browsers.


    Karma has an option for loading addition files in the browser. bb-test has a similar option where you can load prebuilt files in the page (even if they're not directly imported into one of the items you're testing).

    For example, if you have a config-bb-module-loader in your project, which relies on the vendor-bb-systemjs item to already be loaded on the page, you can tell bb-test to always include vendor-bb-systemjs on the page.


    bb-test supports it's own set of test plugins. A bb-test plugin is an npm package that begins with @bb-cli/bb-test-plugin-. To load a plugin just provide that last part of the name to bb-test unit.

    For example, there is an angular-mocks plugin that enables you to use ngmock in your tests, and can be loaded via --test-plugins=ngmock


    Install Firefox launcher and run with firefox:

      $ npm install -g karma-firefox-launcher
      $ bb-test unit --browsers Firefox

    Or run with Firefox AND Chrome:

      $ bb-test unit --browsers Firefox,Chrome

    Install and run with test plugin @bb-cli/bb-test-plugin-ngmock (which adds support for angular-mocks):

      $ npm install -g @bb-cli/bb-test-plugin-ngmock
      $ bb-test unit --test-plugins ngmock

    Run tests with support for compiling sass files:

      $ npm install -g @bb-cli/bb-build-plugin-sass
      $ bb-test unit --build-plugins sass

    Create html & lcov coverage in reports/ dir, and print coverage to stdout:

      $ bb-test unit --coverage text-summary,html,lcov

    Combining aliases for test-plugins, build-plugins, browsers, and coverage as you might do on a jenkins machine:

      $ bb-test unit -t ngmock -b sass -B PhantomJS --coverage lcov,text-summary

    Instead of the current directory, look for CXP source items in src/ with additional prebuilt dependencies in prebuilt/. Note: this will still search for dependencies in node_modules and target/backbase:

      $ bb-test unit src/ --prebuilt prebuilt/

    Load vendor-bb-systemjs into the browser so the System global is defined:

      $ bb-test unit --load-prebuilt vendor-bb-systemjs


    bb-test will generate an entry file for the tests. By default a tmp file will be created. Use this to write to a specific file for the test entry. This can be useful for debugging issues with bb-test.



    Set the amount of log output


    Set whether or not to use colors in output



    npm i @bb-cli/bb-test

    DownloadsWeekly Downloads






    Unpacked Size

    116 kB

    Total Files


    Last publish


    • bb-cli