Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion jest/private/jest_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ _attrs = dicts.add(js_binary_lib.attrs, {
),
})

def _quote(ctx, str):
# Use double quotes on Windows hosts, single quotes elsewhere
quote_char = '"' if ctx.configuration.host_path_separator == ";" else "'"
return quote_char + str + quote_char

def _impl(ctx):
providers = []
generated_config = ctx.actions.declare_file("%s__jest.config.mjs" % ctx.label.name)
Expand Down Expand Up @@ -102,7 +107,7 @@ def _impl(ctx):
"--config",
# quote the path since it might have special chars such as parens.
# quoting ensures that the shell doesn't do any globbing or splitting.
"'" + paths.join(unwind_chdir_prefix, generated_config.short_path) + "'",
_quote(ctx, paths.join(unwind_chdir_prefix, generated_config.short_path)),
])
if ctx.attr.log_level == "debug":
fixed_args.append("--debug")
Expand Down