Run the tests in headless mode and output the logs
bazel test :hello_world --test_output=all
Start up a visible web browser with the karma test driver
(need to go to Debug tab to actually run tests)
bazel run :hello_world
Suggested review order
- package.json to see the karma dependencies to run
jasmine tests on chrome and firefox.
- WORKSPACE.bazel to see how the packages listed in
package.json and package-lock.json are downloaded
into the Bazel sandbox/cache via the npm_install rule.
As mentioned in the package.json comment, the version
of build_bazel_rules_nodejs which emscripten uses [1]
is 4.4.1 and if we tried to install it ourselves, that
installation will be ignored. We also bring in hermetic
browsers via io_bazel_rules_webtesting.
- bazel/karma_test.bzl which defines a new rule _karma_test
and a macro karma_test which joins the new rule with
an existing web_test rule to run it on a hermetic browser
which Bazel downloads. This rule takes heavy inspiration
from @bazel/concatjs [2], but is much simpler and lets us
configure more things (e.g. proxies, so we can work with
test_on_env).
- karma.bazel.js, which is a pretty ordinary looking karma
configuration file [2] with effectively a JS macro
BAZEL_APPLY_SETTINGS. JS doesn't have a preprocessor or
actual macros, but this string will be replaced by the
JS code in karma_test.bzl which will set correct filepaths
for Bazel content.
- All other files.
[1] c33c7be17f/bazel/deps.bzl (L10)
[2] 700b7a3c5f/packages/concatjs/web_test/karma_web_test.bzl (L318)
[3] http://karma-runner.github.io/6.3/config/configuration-file.html
Change-Id: Id64c0a86d6be37d627762cef0beaaf23ad390ac1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509717
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>