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
.
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 ["@build_bazel_rules_nodejs//@bazel/protractor", "@npm//protractor"]
protractor_entry_point
A label providing the protractor entry point
Default to :node_modules/protractor/bin/protractor
.
Defaults to "@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.
3.0.0-rc.0 (2020-12-11)
Bug Fixes
- builtin: --nobazel_run_linker implies --bazel_patch_module_resolver (7100277)
- remove jasmine-core as a peer dep (#2336) (bb2a302)
- builtin: give a longer timeout for _create_build_files (5d405a7), closes #2231
- builtin: give better error when linker runs on Node <10 (b9dc2c1), closes #2304
- builtin: make linker deterministic when resolving from manifest & fix link_workspace_root with no runfiles (f7c342f)
- examples: fix jest example on windows (3ffefa1), closes #1454
- exmaples/nestjs: add module_name field in ts_library (3a4155c)
- typescript: don't depend on protobufjs, it's transitive (1b344db)
- typescript: fail the build when ts_project produces zero outputs (3ca6cac), closes #2301
- npm_package.pack on Windows should not generate undefined.tgz (715ad22)
- typescript: specify rootDir as absolute path (535fa51)
- npm_package.pack should work in windows os (503d6fb)
- typescript: don't include _valid_options marker file in outs (570e34d), closes #2078
chore
Code Refactoring
Features
- builtin: flip the default of the strict_visibility flag on the npm and yarn install rules to True (2c34857)
- concatjs: ts_devserver -> concatjs_devserver; move to @bazel/concatjs (baeae89), closes #1082
- cypress: remove browiserify preprocessor (98ee87d)
- examples: adds example for running jest with typescript (#2245) (d977c73)
- node_repositories: Added auth option for downloading nodejs and yarn (c89ff38)
- typescript: add allow_js support to ts_project (91a95b8)
- typescript: worker mode for ts_project (#2136) (5d70997)
Performance Improvements
- cypress: pack cypress runfiles into a single tar (e8484a0)
BREAKING CHANGES
- By default, we no longer patch the require() function, instead you should rely on the linker to make node modules resolvable at the standard location
if this breaks you, the quickest fix is to flip the flag back on a nodejs_binary/nodejs_test/npm_package_bin with
templated_args = ["--bazel_patch_module_resolver"]
, see https://github.com/bazelbuild/rules_nodejs/pull/2344 as an example.
Another fix is to explicitly use our runfiles helper library, see https://github.com/bazelbuild/rules_nodejs/pull/2341 as an example. packages/karma:package.bzl
is gone, in your WORKSPACE replace
load("//packages/karma:package.bzl", "npm_bazel_karma_dependencies")
npm_bazel_karma_dependencies()
with the equivalent
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "9bb461d5ef08e850025480bab185fd269242d4e533bca75bfb748001ceb343c3",
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz"],
)
Then in BUILD files replace
load("@npm//@bazel/karma:index.bzl", "karma_web_test_suite")
with
load("@npm//@bazel/concatjs:index.bzl", "concatjs_web_test_suite")
finally drop npm dependencies on @bazel/karma
and depend on @bazel/concatjs
instead
- concatjs_web back to karma_web
- typescript: any ts_project rule that produces no outputs must be fixed or removed
- pkg_web#move_files helper is now a private API
-
- rollup_bundle config_file no longer has substitutions from a "bazel_stamp_file" - use bazel_version_file instead
- pkg_npm no longer has replace_with_version attribute, use substitutions instead
- concatjs: users need to change their load statements for ts_devserver
- Users will need to rename
build_bazel_rules_typescript
to npm_bazel_typescript
and build_bazel_rules_karma
to npm_bazel_karma
in their projects - If you use the internal API of tsc_wrapped you need to update the CompilerHost constructor calls.