Open adventurist opened 1 month ago
Where are your tests at? When you run electron-mocha with the renderer
and url
options, the window will load your URL and also mocha will run in that window looking for the test files supplied on the command line. You can add the --interactive
option which will keep your window open after the tests have run to inspect this further.
Where are your tests at? When you run electron-mocha with the
renderer
andurl
options, the window will load your URL and also mocha will run in that window looking for the test files supplied on the command line. You can add the--interactive
option which will keep your window open after the tests have run to inspect this further.
Thank you, the --interactive
is going to be helpful.
As for the tests, they are only available from a remote location. Ultimately they are on a private ip, but for now I'm doing a proof of concept where I'm simply hosting them http://localhost:8891
.
If absolutely forced to, I could download them and make the file available for loading as a runtime argument, but I was hoping to simply load via URL, since it's the same data. Is there any way to do that, or must there always be a runtime argument? (the tests are to run in the Renderer)
With --renderer
electron-mocha runs mocha in your window, so you need a way to communicate with the the tests you load from the remote location, mocha can't just find them automatically. For example, you could add a test that loads and runs the remote tests: that is, it would probably check that the page has loaded, then run the tests and either fail or succeeded based on the result of the tests. This is one option albeit a silly one: you don't really need a test runner to run a single test which calls another test runner.
Issue
I am serving mocha tests that I wish to consume using Electron's
loadURL
function.When I attempt to do this using
electron-mocha
, I get this error:Assumption
electron-mocha has been designed with the expectation that test files are always available locally.
Setup
Dependencies
Running
node_modules/.bin/electron-mocha --url=http://localhost:8891 --main=electron-main.js --renderer=true
Any guidance would be greatly appreciated!