disable the Bun.jest function

This commit is contained in:
pfg
2025-08-20 18:32:18 -07:00
parent 97495a86fe
commit 2f6e99c244
3 changed files with 6 additions and 20 deletions

View File

@@ -529,30 +529,13 @@ pub const Jest = struct {
pub fn call(
globalObject: *JSGlobalObject,
callframe: *CallFrame,
_: *CallFrame,
) bun.JSError!JSValue {
const vm = globalObject.bunVM();
if (vm.is_in_preload or runner == null) {
return Bun__Jest__testPreloadObject(globalObject);
}
const arguments = callframe.arguments_old(2).slice();
if (arguments.len < 1 or !arguments[0].isString()) {
return globalObject.throw("Bun.jest() expects a string filename", .{});
}
var str = try arguments[0].toSlice(globalObject, bun.default_allocator);
defer str.deinit();
const slice = str.slice();
if (!std.fs.path.isAbsolute(slice)) {
return globalObject.throw("Bun.jest() expects an absolute file path, got '{s}'", .{slice});
}
const filepath = Fs.FileSystem.instance.filename_store.append([]const u8, slice) catch unreachable;
var scope = runner.?.getOrPutFile(filepath);
scope.push();
return Bun__Jest__testModuleObject(globalObject);
}
@@ -2495,7 +2478,6 @@ const ExpectTypeOf = expect.ExpectTypeOf;
const bun = @import("bun");
const ArrayIdentityContext = bun.ArrayIdentityContext;
const Environment = bun.Environment;
const Fs = bun.fs;
const MutableString = bun.MutableString;
const Output = bun.Output;
const RegularExpression = bun.RegularExpression;

View File

@@ -1816,6 +1816,10 @@ pub const TestCommand = struct {
const file_path = resolution.path_pair.primary.text;
const file_title = bun.path.relative(FileSystem.instance.top_level_dir, file_path);
const filepath = bun.fs.FileSystem.instance.filename_store.append([]const u8, file_path) catch unreachable;
var scope = bun.jsc.Jest.Jest.runner.?.getOrPutFile(filepath);
scope.push();
// In Github Actions, append a special prefix that will group
// subsequent log lines into a collapsable group.
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines

View File

@@ -3,7 +3,7 @@
" == undefined": 0,
"!= alloc.ptr": 0,
"!= allocator.ptr": 0,
".arguments_old(": 279,
".arguments_old(": 278,
".jsBoolean(false)": 0,
".jsBoolean(true)": 0,
".stdDir()": 41,