aboutsummaryrefslogtreecommitdiff
path: root/src/cli/test_command.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/test_command.zig')
-rw-r--r--src/cli/test_command.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig
index 996289ac4..8330a786b 100644
--- a/src/cli/test_command.zig
+++ b/src/cli/test_command.zig
@@ -382,6 +382,7 @@ const Scanner = struct {
pub const TestCommand = struct {
pub const name = "test";
pub const old_name = "wiptest";
+
pub fn exec(ctx: Command.Context) !void {
if (comptime is_bindgen) unreachable;
// print the version so you know its doing stuff if it takes a sec
@@ -460,6 +461,18 @@ pub const TestCommand = struct {
vm.is_main_thread = true;
JSC.VirtualMachine.is_main_thread_vm = true;
+ // For tests, we default to UTC time zone
+ // unless the user inputs TZ="", in which case we use local time zone
+ var TZ_NAME: string =
+ // We use the string "Etc/UTC" instead of "UTC" so there is no normalization difference.
+ "Etc/UTC";
+ if (vm.bundler.env.get("TZ")) |tz| {
+ TZ_NAME = tz;
+ }
+ if (TZ_NAME.len > 0) {
+ _ = vm.global.setTimeZone(&JSC.ZigString.init(TZ_NAME));
+ }
+
var scanner = Scanner{
.dirs_to_scan = Scanner.Fifo.init(ctx.allocator),
.options = &vm.bundler.options,