I won't lie, I've used the original expect just because I needed to force a program to run in a pty. It turns out that script(1) will also do this though.
Create isatty.so like this:
echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o isatty.so -xc -
Then to make `some_program` think it's in a tty: LD_PRELOAD=./isatty.so some_programe
Source and more: https://unix.stackexchange.com/questions/249723/how-to-trick...