Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest hangs on default socket #1

Open
flaviut opened this issue Jun 9, 2023 · 0 comments
Open

Jest hangs on default socket #1

flaviut opened this issue Jun 9, 2023 · 0 comments

Comments

@flaviut
Copy link

flaviut commented Jun 9, 2023

Hey, I ran into Jest hanging for me due to the import-time construction of the socket. I would suggest removing the default socket functionality from this software & requiring the user initialize & manage the lifecycle of their own objects.

In the meanwhile, I've worked around this in two ways. I've changed my import to be conditional:

const transport =
  process.ppid === 1
    ? require("@app/utils/systemd-log-transport").default()
    : pino.destination(process.stdout.fd);

and I've added a jest globalTeardown script to trigger the closing of this socket:

module.exports = () => {
  // required to close the systemd-log-transport if it is used
  process.emit("beforeExit");
};

I appreciate your work on this project, it's been very helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant