@bazel/protractor

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

Run Protractor tests under Bazel

原始使用文档
文档目录4 节
  1. Installation
  2. Known issues with running Chromium for macOS/Windows in Baz…
  3. protractor_web_test
  4. protractor_web_test_suite

Protractor rules for Bazel

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

Installation

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

Known issues with running Chromium for macOS/Windows in Bazel

For macOS and Windows, Chromium comes with files that contain spaces in their file names. This breaks runfile tree creation within Bazel due to a bug. There are various workarounds that allow for Chromium on these platforms:

  • Instruct Bazel to automatically disable runfile tree creation if not needed. More details here
  • Instruct Bazel to use an alternative experimental approach for creating runfile trees. More details here

protractor_web_test

USAGE

protractor_web_test(name, configuration, on_prepare, srcs, deps, data, server, tags, peer_deps,
                    protractor_entry_point, kwargs)

Runs a protractor test in a browser.

PARAMETERS

name

The name of the test

configuration

Protractor configuration file.

Defaults to None

on_prepare

A file with a node.js script to run once before all tests run. If the script exports a function which returns a promise, protractor will wait for the promise to resolve before beginning tests.

Defaults to None

srcs

JavaScript source files

Defaults to []

deps

Other targets which produce JavaScript such as ts_library

Defaults to []

data

Runtime dependencies

Defaults to []

server

Optional server executable target

Defaults to None

tags

Standard Bazel tags, this macro adds one for ibazel

Defaults to []

peer_deps

List of peer npm deps required by protractor_web_test

Defaults to ["@npm//@bazel/protractor", "@npm//protractor"]

protractor_entry_point

A label providing the protractor entry point Default to :node_modules/protractor/bin/protractor.

Defaults to Label("@npm//:node_modules/protractor/bin/protractor")

kwargs

passed through to protractor_web_test

protractor_web_test_suite

USAGE

protractor_web_test_suite(name, browsers, web_test_data, wrapped_test_tags, kwargs)

Defines a test_suite of web_test targets that wrap a protractor_web_test target.

PARAMETERS

name

The base name of the test

browsers

A sequence of labels specifying the browsers to use.

Defaults to None

web_test_data

Data dependencies for the wrapper web_test targets.

Defaults to []

wrapped_test_tags

A list of test tag strings to use for the wrapped karma_web_test target.

Defaults to ["manual", "noci"]

kwargs

Arguments for the wrapped karma_web_test target.

版本与发布记录

@bazel/protractor 共发布 106 个版本,首次发布于 2019/07/24;过去 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/protractor 的常见问题

@bazel/protractor 是什么?

Run Protractor tests under Bazel

如何安装 @bazel/protractor?

在项目目录运行 npm install @bazel/protractor,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:protractor(>=5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bazel/protractor 支持 TypeScript 吗?

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

@bazel/protractor 支持 ESM 还是 CommonJS?

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

@bazel/protractor 可以商用吗?

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

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

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

@bazel/protractor 还在维护吗?

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