Jasmine rules for Bazel
WARNING: this is beta-quality software. Breaking changes are likely. Not recommended for production use without expert support.
The Jasmine rules run tests under the Jasmine framework with Bazel.
Installation
Add the @bazel/jasmine
npm package to your devDependencies
in package.json
.
Your WORKSPACE
should declare a yarn_install
or npm_install
rule named npm
.
It should then install the rules found in the npm packages using the `install_bazel_dependencies' function.
See https://github.com/bazelbuild/rules_nodejs/#quickstart
This causes the @bazel/jasmine
package to be installed as a Bazel workspace named npm_bazel_jasmine
.
NodeJS testing
Macros
Overview
These rules let you run tests outside of a browser. This is typically faster
than launching a test in Karma, for example.
jasmine_node_test
jasmine_node_test(name, srcs, data, deps, expected_exit_code, tags, coverage, jasmine, jasmine_entry_point, **kwargs)
Runs tests in NodeJS using the Jasmine test runner.
To debug the test, see debugging notes in nodejs_test
.
Attributes
name |
Name; Required
Name of the resulting label
|
srcs |
List of strings; Optional
JavaScript source files containing Jasmine specs
|
data |
List of strings; Optional
Runtime dependencies which will be loaded while the test executes
|
deps |
List of strings; Optional
Other targets which produce JavaScript, such as ts_library
|
expected_exit_code |
Integer; Optional
The expected exit code for the test. Defaults to 0.
|
tags |
List of strings; Optional
Bazel tags applied to test
|
coverage |
Boolean; Optional; Default is False
Enables code coverage collection and reporting. Defaults to False.
|
jasmine |
String; Optional
A label providing the @bazel/jasmine npm dependency.
|
jasmine_entry_point |
String; Optional
A label providing the @bazel/jasmine entry point.
|
**kwargs |
Unknown; Optional
Remaining arguments are passed to the test rule
|