Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
8e2ed555b7 Use AnyWriter for console formatter 2025-03-24 18:18:41 -07:00
3 changed files with 1310 additions and 1253 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1302,7 +1302,7 @@ pub const JestPrettyFormat = struct {
} else if (value.as(JSC.ResolveMessage)) |resolve_log| {
resolve_log.msg.writeFormat(writer_, enable_ansi_colors) catch {};
return;
} else if (printAsymmetricMatcher(this, Format, &writer, writer_, name_buf, value, enable_ansi_colors)) {
} else if (printAsymmetricMatcher(this, &writer, writer_, &name_buf, value, enable_ansi_colors)) {
return;
} else if (jsType != .DOMWrapper) {
if (value.isCallable()) {
@@ -2041,18 +2041,15 @@ pub const JestPrettyFormat = struct {
pub fn printAsymmetricMatcher(
// the Formatter instance
this: anytype,
comptime Format: anytype,
/// The WrappedWriter
writer: anytype,
/// The raw writer
writer_: anytype,
/// Buf used to print strings
name_buf: [512]u8,
name_buf: *[512]u8,
value: JSValue,
comptime enable_ansi_colors: bool,
) bool {
_ = Format;
if (value.as(expect.ExpectAnything)) |matcher| {
printAsymmetricMatcherPromisePrefix(matcher.flags, this, writer);
if (matcher.flags.not) {
@@ -2074,7 +2071,7 @@ pub const JestPrettyFormat = struct {
writer.writeAll("Any<");
}
var class_name = ZigString.init(&name_buf);
var class_name = ZigString.init(name_buf);
constructor_value.getClassName(this.globalThis, &class_name);
this.addForNewLine(class_name.len);
writer.print(comptime Output.prettyFmt("<cyan>{}<r>", enable_ansi_colors), .{class_name});

View File

@@ -588,11 +588,11 @@ pub const RunCommand = struct {
const is_probably_trying_to_run_a_pkg_script =
original_script_for_bun_run != null and
((code == 1 and bun.strings.eqlComptime(original_script_for_bun_run.?, "test")) or
(code == 2 and bun.strings.eqlAnyComptime(original_script_for_bun_run.?, &.{
"install",
"kill",
"link",
}) and ctx.positionals.len == 1));
(code == 2 and bun.strings.eqlAnyComptime(original_script_for_bun_run.?, &.{
"install",
"kill",
"link",
}) and ctx.positionals.len == 1));
if (is_probably_trying_to_run_a_pkg_script) {
// if you run something like `bun run test`, you get a confusing message because
@@ -1077,9 +1077,7 @@ pub const RunCommand = struct {
bun.copy(u8, path_buf[dir_slice.len..], base);
path_buf[dir_slice.len + base.len] = 0;
const slice = path_buf[0 .. dir_slice.len + base.len :0];
if (Environment.isWindows) {
@panic("TODO");
}
if (!(bun.sys.isExecutableFilePath(slice))) continue;
// we need to dupe because the string pay point to a pointer that only exists in the current scope
_ = try results.getOrPut(this_transpiler.fs.filename_store.append(@TypeOf(base), base) catch continue);