Jasmine rules for Bazel

The Jasmine rules run tests under the Jasmine framework with Bazel.

Installation

Add the @bazel/jasmine npm package to your devDependencies in package.json.

Macros and Functions

jasmine_node_test

Runs tests in NodeJS using the Jasmine test runner.

Detailed XML test results are found in the standard bazel-testlogs directory. This may be symlinked in your workspace. See https://docs.bazel.build/versions/main/output_directories.html

To debug the test, see debugging notes in nodejs_test.

Example usage (generated)

load("@build_bazel_rules_nodejs//packages/jasmine:index.bzl", "jasmine_node_test")

jasmine_node_test(
    # Name of the resulting label
    name = "",
)

name

Name of the resulting label

srcs

JavaScript source files containing Jasmine specs

data

Runtime dependencies which will be loaded while the test executes

deps

Other targets which produce JavaScript, such as ts_library

expected_exit_code

The expected exit code for the test.

tags

Bazel tags applied to test

config_file

(experimental) label of a file containing Jasmine JSON config.

Note that not all configuration options are honored, and we expect some strange feature interations. For example, the filter for which files are instrumented for code coverage doesn't understand the spec_files setting in the config.

See https://jasmine.github.io/setup/nodejs.html#configuration

use_direct_specs

Limits the list of specs added to the execution (test suite) to direct sources.

Note that this is a bug fix opt-in flag, which will be the default behavior in the next major release.

More info: https://github.com/bazelbuild/rules_nodejs/pull/2576

jasmine

A label providing the @bazel/jasmine npm dependency.

jasmine_entry_point

A label providing the @bazel/jasmine entry point.

kwargs

Remaining arguments are passed to the test rule