I am using electron react boilerplate as base for my project. I wrote small backend for it, which uses winston to write logs.
Jest can easly test single functions and components but I need help with e2e tests. Because this app is using ipcRenderer, cypress throws errors that ipcRenderer is undefined so it cannot connect backend.
Are there any tools that can access electron's ipcRenderer to send messages ? Easiest way to fix it would be to push electron as dependency, instead of devDependency, but I don't think it should be done that way
Thx in advance
Related
I'm making an API for a website (this is open source you can find the repo and look by yourself here : https://github.com/PirateSeal/Operation-Green-Axe-2)
I'm making tests suites with jest and supertest and i'm using knex to connect and talk with my db.
My problem is that i can't run multiple tests suites because the first one is "locking" access to my db.
In each of my tests files I implemented the BeforeAll() and AfterAll() methods to create and teardown my db and instead of doing that for each test, i'd like to create a setup file that will run before all tests suites and after all.
I read about jest setup file but i didn't understand how to use it.
Can you help me please ?
(this is my first question here btw pls be kind :) )
I have some JavaScript unit tests that I need to run. We use a combination of mocha and chai for the tests. We are looking into possibly switching to Capacitor as a tool to convert web apps to mobile and electron projects. In order to get Capacitor working in our unit tests we have to run the tests using jsdom as Capacitor makes use of the window object. Now the unit tests are run through jsdom these parts of Capacitor are happy and our tests pass.
However we have one module that will require the use of Capacitor's Filesystem API. Filesystem has no web implementation so these tests now fail as we are using jsdom. The log states Filesystem does not have web implementation.. Is there any way I can get a combination of having window available in our unit tests while also allowing the use of Filesystem?
I was able to fix this. I used jsdom from the terminal and it didn't work. However using the JavaScript API I was able to get that test to pass.
There is an App build with Grunt. While building, Karma runs some unit-tests for client, using Phantom JS.
There is a new component, working with server via WebSocket. And i need to cover it with some tests. Then working with Ajax, everything is much more clear. There is a description how to do ajax-tests in Jasmine tutorial. But i have no idea there to start with WebSocket testing.
How did you solved this problem? How should i write and run this tests?
I'm building my app using backbone and react inside of a rails app. I saw that all the recommended test packages (jest, jasmine, etc) are all node based. From what I know, I can get node on my rails project but I'd prefer not to.
Is there a way to test with something like jest without node? Or is there another package that isn't based on node that works with react.
Many test frameworks have browser based test runners, if you're willing to give up command line based testing then you can do this. Jasmine and Mocha both allow this.
Node.js is the de facto platform for web development tools (Ruby being the second most popular). Consider adopting the dependency, or you'll be fighting an uphill battle.
as I'm developing a web application using AngularJS in the front-end and Node.js in the server. For now I'm writing tests for the node server (based on Express) using Mocha (+ Chai + Supertest), and client side tests using Mocha and Testacular as a test runner, since Testacular is the tool of choice with Angular.
Note that the Angular app is "embedded" in the node app, as it's located in the template files.
My testing process : for server tests, I just npm test, i.e. mocha <my-test-folder> <my-test-options> ; for client tests, I launch a Testacular server that watches changes in the desired files. But I don't like this parallel and disconnected process and I'm sure there's a better, unified automated way.
Could help me refine the process ?
In my travels I haven't seen a precident for this, but you should be able to achieve it using grunt. You can make a grunt target that calls both.
I have a github project that should help show how to use testacular on an angular project using grunt which will at least help with the client part; will help get you part of the way there.