skia2/package.json

14 lines
385 B
JSON
Raw Normal View History

[bazel] Make custom karma_test rule 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] https://github.com/emscripten-core/emsdk/blob/c33c7be17f047355aa13a59f62a05100f9ff3257/bazel/deps.bzl#L10 [2] https://github.com/bazelbuild/rules_nodejs/blob/700b7a3c5f97f2877320e6e699892ee706f85269/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>
2022-02-23 14:02:11 +00:00
{
"//": [
"These versions of these were the latest version avaiable at the time of writing",
"with the exception of jasmine, which was version 3 because our tests currently use v3."
],
"devDependencies": {
"jasmine-core": "3.10.1",
"karma": "6.3.15",
"karma-chrome-launcher": "3.1.0",
"karma-firefox-launcher": "2.1.2",
"karma-jasmine": "4.0.1"
}
}