Skip to content

Commit

Permalink
feat(bazel): support explicit files in spec-entrypoint
Browse files Browse the repository at this point in the history
This will be helpful for using the rule in `jasmine_node_test`
where explicit specs may be passed through `srcs`.
  • Loading branch information
devversion committed Dec 16, 2022
1 parent 246cebb commit edfb9b5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bazel/spec-bundling/spec-entrypoint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _spec_entrypoint_impl(ctx):
spec_entrypoint = rule(
implementation = _spec_entrypoint_impl,
attrs = {
"deps": attr.label_list(allow_files = False, mandatory = True),
"bootstrap": attr.label_list(allow_files = False, mandatory = True),
"deps": attr.label_list(allow_files = True, mandatory = True),
"bootstrap": attr.label_list(allow_files = True, mandatory = True),
},
)
12 changes: 11 additions & 1 deletion bazel/spec-bundling/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: We need to test with the raw jasmine rule here because our default
# repo rule uses spec-bundling as well, with some additional defaults.
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//bazel/spec-bundling:index.bzl", "spec_bundle")
load("//bazel/spec-bundling:index.bzl", "spec_bundle", "spec_entrypoint")
load("//tools:defaults.bzl", "ts_library")

ts_library(
Expand Down Expand Up @@ -47,6 +47,16 @@ ts_library(
],
)

spec_entrypoint(
name = "explicit_file_entrypoint",
testonly = True,
bootstrap = [],
deps = [
"some_spec.js",
":test_lib_apf",
],
)

spec_bundle(
name = "test_bundle",
platform = "node",
Expand Down
5 changes: 5 additions & 0 deletions bazel/spec-bundling/test/some_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('some spec no compilation', () => {
it('should work', () => {
expect(true).toBe(false);
});
});

0 comments on commit edfb9b5

Please sign in to comment.