1 | ## KARMA PLUGINS
|
2 |
|
3 | All karma plugins are automatically loaded. Karma plugins are npm packages that
|
4 | are installed as peers to bb-test, and begin with 'karma-'.
|
5 |
|
6 | ## BROWSERS
|
7 |
|
8 | Chrome is the default launcher used, but there is support for any karma launcher.
|
9 |
|
10 | Because karma plugins are loaded automatically, just install the correct plugin
|
11 | for the browser you want to launch. For example, you can install the Firefox
|
12 | Launcher and run bb-test unit with --browsers=Firefox. Make sure to consult
|
13 | the launchers documentation for the correct name of the browser.
|
14 |
|
15 | It can also accept a comma separated list of browsers.
|
16 |
|
17 | ## TEST PLUGINS
|
18 |
|
19 | bb-test supports it's own set of test plugins. A bb-test plugin is an npm
|
20 | package that begins with @bb-cli/bb-test-plugin-. To load a plugin just provide
|
21 | that last part of the name to bb-test unit.
|
22 |
|
23 | For example, there is an angular-mocks plugin that enables you to use ngmock
|
24 | in your tests, and can be loaded via --test-plugins=ngmock
|
25 | https://www.npmjs.com/package/@bb-cli/bb-test-plugin-ngmock
|
26 |
|
27 | # EXAMPLES
|
28 |
|
29 | Install Firefox launcher and run with firefox:
|
30 |
|
31 | ```bash
|
32 | $ npm install -g karma-firefox-launcher
|
33 | $ bb-test unit --browsers Firefox
|
34 | ```
|
35 |
|
36 | Or run with Firefox AND Chrome:
|
37 |
|
38 | ```bash
|
39 | $ bb-test unit --browsers Firefox,Chrome
|
40 | ```
|
41 |
|
42 | Install 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 |
|
50 | Run 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 |
|
57 | Create 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 |
|
63 | Combining aliases for test-plugins, build-plugins, browsers, and coverage as
|
64 | you 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 |
|
70 | Instead of the current directory, look for CXP source items in src/ with
|
71 | additional prebuilt dependencies in prebuilt/. Note: this will still search
|
72 | for dependencies in node_modules and target/backbase:
|
73 |
|
74 | ```bash
|
75 | $ bb-test unit src/ --prebuilt prebuilt/
|
76 | ``` |
\ | No newline at end of file |