Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
rename to ts_web_test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Dec 12, 2017
1 parent 9002c39 commit 79f1562
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ load("//internal:build_defs.bzl", _ts_library = "ts_library")
load("//internal:ts_config.bzl", _ts_config = "ts_config")
load("//internal/devserver:ts_devserver.bzl", _ts_devserver = "ts_devserver_macro")
load("//internal:ts_repositories.bzl", _ts_repositories = "ts_repositories")
load("//internal:ts_test.bzl", _ts_test = "ts_web_test_macro")
load("//internal:ts_web_test.bzl", _ts_web_test = "ts_web_test_macro")

ts_library = _ts_library
ts_config = _ts_config
Expand Down
4 changes: 2 additions & 2 deletions examples/testing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")

ts_library(
name = "lib",
Expand All @@ -12,7 +12,7 @@ ts_library(
testonly = 1,
)

ts_test(
ts_web_test(
name = "testing",
deps = [
":tests",
Expand Down
1 change: 1 addition & 0 deletions internal/karma/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ nodejs_binary(
name = "karma_bin",
entry_point = "karma/bin/karma",
data = [":karma_concat_js"],
node_modules = "@build_bazel_rules_typescript_karma_deps//:node_modules",
)
13 changes: 13 additions & 0 deletions internal/karma/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"description": "runtime dependences for ts_web_test rules",
"devDependencies": {
"@types/tmp": "0.0.33",
"jasmine-core": "2.8.0",
"karma": "alexeagle/karma#fa1a84ac881485b5657cb669e9b4e5da77b79f0a",
"karma-chrome-launcher": "2.2.0",
"karma-jasmine": "1.1.1",
"karma-requirejs": "1.1.0",
"requirejs": "2.3.5",
"tmp": "0.0.33"
}
}
4 changes: 4 additions & 0 deletions internal/ts_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ def ts_repositories():
name = "build_bazel_rules_typescript_devserver_deps",
package_json = "@build_bazel_rules_typescript//internal/devserver:package.json",
)
npm_install(
name = "build_bazel_rules_typescript_karma_deps",
package_json = "@build_bazel_rules_typescript//internal/karma:package.json",
)
12 changes: 6 additions & 6 deletions internal/ts_test.bzl → internal/ts_web_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load("@build_bazel_rules_nodejs//internal:node.bzl",
_CONF_TMPL = "//internal/karma:karma.conf.js"
_LOADER = "//internal/karma:test-main.js"

def _ts_test_impl(ctx):
def _ts_web_test_impl(ctx):
conf = ctx.actions.declare_file(
"%s.conf.js" % ctx.label.name,
sibling=ctx.outputs.executable)
Expand Down Expand Up @@ -65,8 +65,8 @@ $KARMA ${{ARGV[@]}}
),
)]

ts_test = rule(
implementation = _ts_test_impl,
ts_web_test = rule(
implementation = _ts_web_test_impl,
test = True,
attrs = {
"srcs": attr.label_list(allow_files = ["js"]),
Expand All @@ -92,10 +92,10 @@ ts_test = rule(

# This macro exists only to modify the users rule definition a bit.
# DO NOT add composition of additional rules here.
def ts_test_macro(tags = [], data = [], **kwargs):
ts_test(
def ts_web_test_macro(tags = [], data = [], **kwargs):
ts_web_test(
# Users don't need to know that this tag is required to run under ibazel
tags = tags + ["iblaze_notify_changes"],
tags = tags + ["ibazel_notify_changes"],
# Our binary dependency must be in data[] for collect_data to pick it up
# FIXME: maybe we can just ask the attr._karma for its runfiles attr
data = data + ["@build_bazel_rules_typescript//internal/karma:karma_bin"],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"typescript": ">=2.4.2"
},
"devDependencies": {
"@bazel/ibazel": "^0.2.0",
"@types/jasmine": "^2.8.2",
"@types/node": "7.0.18",
"@types/source-map": "^0.5.1",
Expand All @@ -27,4 +28,4 @@
"pretest": "webdriver-manager update && bazel build examples/app:all",
"test": "concurrently \"bazel run examples/app:devserver\" protractor --kill-others --success first"
}
}
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# yarn lockfile v1


"@bazel/ibazel@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.2.0.tgz#c119aef4344a789cef5e792caaee52264123e71c"

"@types/jasmine@^2.8.2":
version "2.8.2"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.2.tgz#6ae4d8740c0da5d5a627df725b4eed71b8e36668"
Expand Down

0 comments on commit 79f1562

Please sign in to comment.