Closed utillity closed 6 years ago
Hi @utillity,
Thank you for your feedback, I'm glad to hear this module is useful to the community.
This module is intended to be run inside an electron environment and is really tied to it. There is not a clear way in which you can test it independently from electron, although it should be possible theoretically. In my opinion, there are various possibilities, I'll try to summarize them:
I expect to this to be useful! :) Please let me know which solution you take at the end or, even better, post it here so others can benefit from it.
Best, Guillermo.
Hi, thanks for the feedback. Well, in my opinion the code could be made a little more robust to just detect that objects it requires are not initialized/available and it could throw an appropriate exception, or just throw errors when trying to send something. Thanks anyways. Tilli
Yes, I totally agree that the code should handle that, and it does. The first part of the module does exactly that. To be more specific, if you are not running inside electron, the call to require('electron')
should fail and the module throws an error for it, maybe jest is patching the require call?
Yes I saw that in your code. I don't know what that remote object is that fails, but there is no check
LG, Tilli
From: m0n0l0c0 notifications@github.com Sent: Friday, January 5, 2018 11:21:55 AM To: m0n0l0c0/electron-router Cc: Tilfried Weissenberger; Mention Subject: Re: [m0n0l0c0/electron-router] jest testing - router cannot be created (#3)
Yes, I totally agree that the code should handle that, and it does. The first parthttps://github.com/m0n0l0c0/electron-router/blob/master/router.js#L16 of the module does exactly that. To be more specific, if you are not running inside electron, the call to require('electron') should fail and the module throws an error for it, maybe jest is patching the require call?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/m0n0l0c0/electron-router/issues/3#issuecomment-355520921, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFSu9mqmXDjxP5xPaFeybeishX9WnZqyks5tHffDgaJpZM4RTYuX.
first of all thanks for the great module. I am using it in a multi-threaded (multi-window, but only the main window is visible) application which gathers information from various channels (IP, CAN-bus, etc.) and displays it in the UI.
When I test an object (using jest) which creates a router, Router(name) fails with the following error:
it seems you access the
remote
object, which is not available in the JEST environment (since electron is not running). is there a way around this?