I am working with bazel in javascript with jasmine. I have been able to run tests successfully with my older app which is written in plain javascript.
I have an app that is written with ES6 markup and hence i use babel
. The way i am able to use babel with bazel is by having a binary babel target and pre-compiling source files then use those targets in a nodejs_binary rule. That works fine. However my tests do not work...bazel says no specs found.
Apparantly bazel is unable to find the spec folder. I think this is because they are pre-compiled with a genrule. I am not sure though. Its my only clue since the similar app i have here works fine.
Is there a way around this? I am not entirely sure how Jasmine works with bazel.
jasmine_node_test(
name = "tests",
data = [
":compiled_src",
":compiled_test",
],
node_modules = "@npm_deps//:node_modules",
)
# Compile source files with babel
genrule(
name = "compiled_src",
srcs = [
":src_files",
],
outs = ["src"],
cmd = "$(location babel) src --out-dir $@",
tools = [":babel"],
)
genrule(
name = "compiled_test",
srcs = [
":test_files",
],
outs = ["spec"],
cmd = "$(location babel) spec --out-dir $@ ",
# output_to_bindir = 1,
tools = [":babel"],
)
nodejs_binary(
name = "babel",
entry_point = "npm_deps/node_modules/babel-cli/bin/babel",
install_source_map_support = False,
node_modules = "@npm_deps//:node_modules",
)
filegroup(
name = "src_files",
srcs = glob([
"src/**/*",
]),
)
filegroup(
name = "test_files",
srcs = glob([
"spec/**/*",
]),
)
Aucun commentaire:
Enregistrer un commentaire