UNPKG

2.22 kBMarkdownView Raw
1## KARMA PLUGINS
2
3All karma plugins are automatically loaded. Karma plugins are npm packages that
4are installed as peers to bb-test, and begin with 'karma-'.
5
6## BROWSERS
7
8Chrome is the default launcher used, but there is support for any karma launcher.
9
10Because karma plugins are loaded automatically, just install the correct plugin
11for the browser you want to launch. For example, you can install the Firefox
12Launcher and run bb-test unit with --browsers=Firefox. Make sure to consult
13the launchers documentation for the correct name of the browser.
14
15It can also accept a comma separated list of browsers.
16
17## TEST PLUGINS
18
19bb-test supports it's own set of test plugins. A bb-test plugin is an npm
20package that begins with @bb-cli/bb-test-plugin-. To load a plugin just provide
21that last part of the name to bb-test unit.
22
23For example, there is an angular-mocks plugin that enables you to use ngmock
24in your tests, and can be loaded via --test-plugins=ngmock
25https://www.npmjs.com/package/@bb-cli/bb-test-plugin-ngmock
26
27# EXAMPLES
28
29Install Firefox launcher and run with firefox:
30
31```bash
32 $ npm install -g karma-firefox-launcher
33 $ bb-test unit --browsers Firefox
34```
35
36Or run with Firefox AND Chrome:
37
38```bash
39 $ bb-test unit --browsers Firefox,Chrome
40```
41
42Install and run with test plugin @bb-cli/bb-test-plugin-ngmock
43(which adds support for angular-mocks):
44
45```bash
46 $ npm install -g @bb-cli/bb-test-plugin-ngmock
47 $ bb-test unit --test-plugins ngmock
48```
49
50Run tests with support for compiling sass files:
51
52```bash
53 $ npm install -g @bb-cli/bb-build-plugin-sass
54 $ bb-test unit --build-plugins sass
55```
56
57Create html & lcov coverage in reports/ dir, and print coverage to stdout:
58
59```bash
60 $ bb-test unit --coverage text-summary,html,lcov
61```
62
63Combining aliases for test-plugins, build-plugins, browsers, and coverage as
64you might do on a jenkins machine:
65
66```bash
67 $ bb-test unit -t ngmock -b sass -B PhantomJS --coverage lcov,text-summary
68```
69
70Instead of the current directory, look for CXP source items in src/ with
71additional prebuilt dependencies in prebuilt/. Note: this will still search
72for dependencies in node_modules and target/backbase:
73
74```bash
75 $ bb-test unit src/ --prebuilt prebuilt/
76```
\No newline at end of file