aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/test/jest.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/test/jest.zig')
-rw-r--r--src/bun.js/test/jest.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/bun.js/test/jest.zig b/src/bun.js/test/jest.zig
index 4c97b5c77..429b79bcc 100644
--- a/src/bun.js/test/jest.zig
+++ b/src/bun.js/test/jest.zig
@@ -127,7 +127,7 @@ pub const TestRunner = struct {
if (this.last_test_timeout_timer_duration != milliseconds) {
this.last_test_timeout_timer_duration = milliseconds;
- this.test_timeout_timer.?.set(this, onTestTimeout, @intCast(i32, milliseconds), @intCast(i32, milliseconds));
+ this.test_timeout_timer.?.set(this, onTestTimeout, @as(i32, @intCast(milliseconds)), @as(i32, @intCast(milliseconds)));
}
}
}
@@ -209,7 +209,7 @@ pub const TestRunner = struct {
pub fn addTestCount(this: *TestRunner, count: u32) u32 {
this.tests.ensureUnusedCapacity(this.allocator, count) catch unreachable;
- const start = @truncate(Test.ID, this.tests.len);
+ const start = @as(Test.ID, @truncate(this.tests.len));
this.tests.len += count;
var statuses = this.tests.items(.status)[start..][0..count];
@memset(statuses, Test.Status.pending);
@@ -218,15 +218,15 @@ pub const TestRunner = struct {
}
pub fn getOrPutFile(this: *TestRunner, file_path: string) *DescribeScope {
- var entry = this.index.getOrPut(this.allocator, @truncate(u32, bun.hash(file_path))) catch unreachable;
+ var entry = this.index.getOrPut(this.allocator, @as(u32, @truncate(bun.hash(file_path)))) catch unreachable;
if (entry.found_existing) {
return this.files.items(.module_scope)[entry.value_ptr.*];
}
var scope = this.allocator.create(DescribeScope) catch unreachable;
- const file_id = @truncate(File.ID, this.files.len);
+ const file_id = @as(File.ID, @truncate(this.files.len));
scope.* = DescribeScope{
.file_id = file_id,
- .test_id_start = @truncate(Test.ID, this.tests.len),
+ .test_id_start = @as(Test.ID, @truncate(this.tests.len)),
};
this.files.append(this.allocator, .{ .module_scope = scope, .source = logger.Source.initEmptyFile(file_path) }) catch unreachable;
entry.value_ptr.* = file_id;
@@ -502,7 +502,7 @@ pub const Jest = struct {
JSError(getAllocator(ctx), "Run \"bun test\" to run a test", .{}, ctx, exception);
return js.JSValueMakeUndefined(ctx);
};
- const arguments = @ptrCast([]const JSC.JSValue, arguments_);
+ const arguments = @as([]const JSC.JSValue, @ptrCast(arguments_));
if (arguments.len < 1 or !arguments[0].isString()) {
JSError(getAllocator(ctx), "Bun.jest() expects a string filename", .{}, ctx, exception);
@@ -1077,7 +1077,7 @@ pub const DescribeScope = struct {
const file = this.file_id;
const allocator = getAllocator(globalObject);
var tests: []TestScope = this.tests.items;
- const end = @truncate(TestRunner.Test.ID, tests.len);
+ const end = @as(TestRunner.Test.ID, @truncate(tests.len));
this.pending_tests = std.DynamicBitSetUnmanaged.initFull(allocator, end) catch unreachable;
if (end == 0) {
@@ -1384,7 +1384,7 @@ pub const TestRunnerTask = struct {
fn deinit(this: *TestRunnerTask) void {
var vm = JSC.VirtualMachine.get();
if (vm.onUnhandledRejectionCtx) |ctx| {
- if (ctx == @ptrCast(*anyopaque, this)) {
+ if (ctx == @as(*anyopaque, @ptrCast(this))) {
vm.onUnhandledRejectionCtx = null;
}
}
@@ -1457,14 +1457,14 @@ inline fn createScope(
var timeout_ms: u32 = Jest.runner.?.default_timeout_ms;
if (options.isNumber()) {
- timeout_ms = @intCast(u32, @max(args[2].coerce(i32, globalThis), 0));
+ timeout_ms = @as(u32, @intCast(@max(args[2].coerce(i32, globalThis), 0)));
} else if (options.isObject()) {
if (options.get(globalThis, "timeout")) |timeout| {
if (!timeout.isNumber()) {
globalThis.throwPretty("{s} expects timeout to be a number", .{signature});
return .zero;
}
- timeout_ms = @intCast(u32, @max(timeout.coerce(i32, globalThis), 0));
+ timeout_ms = @as(u32, @intCast(@max(timeout.coerce(i32, globalThis), 0)));
}
if (options.get(globalThis, "retry")) |retries| {
if (!retries.isNumber()) {
@@ -1642,7 +1642,7 @@ pub fn printGithubAnnotation(exception: *JSC.ZigException) void {
var i: i16 = 0;
while (i < frames.len) : (i += 1) {
- const frame = frames[@intCast(usize, i)];
+ const frame = frames[@as(usize, @intCast(i))];
const source_url = frame.source_url.toUTF8(allocator);
defer source_url.deinit();
const file = bun.path.relative(dir, source_url.slice());