-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use Bazel expand_location function instead of our own
This allows a mocha_test macro to be neatly written - otherwise it got inputs like wksp_name/./file.js
- Loading branch information
Showing
9 changed files
with
360 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"Example mocha_test macro" | ||
|
||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") | ||
|
||
def mocha_test(name, srcs = [], deps = [], **kwargs): | ||
nodejs_test( | ||
name = name, | ||
entry_point = "@npm//:node_modules/mocha/bin/mocha", | ||
data = srcs + deps + [ | ||
"@npm//mocha", | ||
], | ||
# We could mix the users args with $(locations) but what if user wants | ||
# to give arg `*.spec.js` - better to stay out of the way. | ||
templated_args = kwargs.pop("args", ["$(locations %s)" % s for s in srcs]), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.