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

Default stream and harness settings cause problems in Electron for Windows #338

Open
binary-koan opened this issue Dec 13, 2016 · 2 comments

Comments

@binary-koan
Copy link

Hi,

I've been trying to do Electron renderer tests with Tape, for an app which (joy of joys) I'm mostly building on Windows. I ran into a couple of problems which I've managed to work around, but might be worth fixing properly:

  1. The special case in default_stream.js where fs.writeSync is used instead of console.log meant I initially had no output at all, because although fs.writeSync is technically supported in the Electron browser, apparently you can't reliably write to stdout with it. My workaround was to use a custom stream which is basically a copy of the default one with that special case removed.
  2. Because Electron exposes a process object to the renderer, Tape assumes that process.on('exit') can be used to write the overall test results. Unfortunately it looks like this event also can't be relied on in the Electron browser, so I had to work around it by creating a harness with autoclose explicitly set to true.

The electron renderer is clearly an odd special case because it's not really a Node.js environment or a plain old browser. Still, it would be great if those sorts of things just worked by default rather than requiring this kind of workaround!

@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2016

These seem like bugs worth being filed on electron directly - especially fs.writeSync writing to stdout.

That said, it also seems prudent, if both practical and possible, to include a workaround in tape.

@binary-koan
Copy link
Author

Getting access to stdout doesn't look hopeful: electron/electron#5051

I'll have to look more into that process.exit one though, seems like that event ought to work so I wonder why it doesn't ...

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

No branches or pull requests

2 participants