@bazel/jasmine

中文文档
5.8.1发布于 2023/02/17Apache-2.0CommonJS近 30 天下载 8.4万

Run Jasmine tests under Bazel

原始使用文档

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.

jasmine_node_test

USAGE

jasmine_node_test(name, srcs, data, deps, expected_exit_code, tags, config_file, use_direct_specs,
                  jasmine, jasmine_entry_point, kwargs)

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.

PARAMETERS

name

Name of the resulting label

srcs

JavaScript source files containing Jasmine specs

Defaults to []

data

Runtime dependencies which will be loaded while the test executes

Defaults to []

deps

Other targets which produce JavaScript, such as ts_project

Defaults to []

expected_exit_code

The expected exit code for the test.

Defaults to 0

tags

Bazel tags applied to test

Defaults to []

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

Defaults to None

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

Defaults to None

jasmine

A label providing the @bazel/jasmine npm dependency. Intended for internal use only.

Defaults to None

jasmine_entry_point

A label providing the @bazel/jasmine entry point. This is a custom wrapper which adds features like sharding and ibazel support. Intended for internal use only.

Defaults to None

kwargs

Remaining arguments are passed to the test rule

版本与发布记录

@bazel/jasmine 共发布 136 个版本,首次发布于 2019/02/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.8.1latest2023/02/173 年前
5.7.32022/12/093 年前
5.7.22022/11/273 年前
5.7.12022/10/274 年前
5.7.02022/10/074 年前
5.6.02022/09/274 年前

其他发布通道:next → 5.0.0-rc.2,lts → 4.6.2。

关于 @bazel/jasmine 的常见问题

@bazel/jasmine 是什么?

Run Jasmine tests under Bazel

如何安装 @bazel/jasmine?

在项目目录运行 npm install @bazel/jasmine,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:jasmine(>=2.99.0)、jasmine-core(>=2.99.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 bazel-jasmine-runner,可以用 npx bazel-jasmine-runner 直接运行。

@bazel/jasmine 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bazel__jasmine 是否存在。

@bazel/jasmine 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bazel/jasmine 可以商用吗?

@bazel/jasmine 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bazel/jasmine 的下载量有多少?

根据 npm 官方下载统计,@bazel/jasmine 在 2026/10/08 – 2026/11/06 这 30 天内被下载 83,954 次,日均约 2,798 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bazel/jasmine 还在维护吗?

最新版本 5.8.1 发布于 2023/02/17(3 年前);至今共发布 136 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/02/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。