Skip to content

util.styleText() doesn't respect isTTY property. #25736

@regseb

Description

@regseb

What version of Bun is running?

1.3.5+1e86cebd7

What platform is your computer?

Linux 6.14.0-37-generic x86_64 x86_64

What steps can reproduce the bug?

// index.js
import { Writable } from "node:stream";
import { styleText } from "node:util";

const streamTTY = new class extends Writable {
    isTTY = true;
};
const streamNoTTY = new class extends Writable {
    isTTY = false;
};

console.log(styleText("bgYellow", "TTY", { stream: streamTTY }));
console.log(styleText("bgYellow", "No TTY", { stream: streamNoTTY }));
bun index.js

What is the expected behavior?

  • TTY (yellow background)
  • No TTY (no background)

What do you see instead?

  • TTY (yellow background)
  • No TTY (yellow background)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions