-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement automatic tests #30
Comments
Do you have any particular format in mind? Zotero looks to use a complex custom setup to test the full program. Better BibTeX uses a Python testing library. Zotxt uses JS and Mocha. |
Hi, Dominic! Thank you for providing that information. I have little to none experience with automatic software testing. So far I have only written some very basic unit tests for the wikibase-edit project, which uses Mocha, and Should.js as assertion library. I'm interested in the Hypothesis web annotation project, to which I have made some contributions, and I understand that their client uses Karma and Mocha, and Chai.js as assertion library. The project I'm currently working with, Wikipedia's Web2Cit, will probably be written mostly in JavaScript. A part will run on users' browsers, and another part on a backend server, probably running Node.js. Therefore, I think I would prefer (so that I can use what I learn in my other projects) a JavaScript testing infrastructure, such as Mocha. Although I don't know whether that would work to test an extension running inside Zotero... What do you think? |
I had a quick look at some options. Using a JS based testing library makes sense, yeah. From what I can tell Mocha and Jest are two popular options and integrate nicely with Node. It could also be nice to integrate with codecov through Github actions (to automatically run tests when someone commits / adds a pull request), but not sure how much extra effort that would be. From some quick searching, you can test React components with Jest and more or less with any framework. Testing the extension in a live Zotero environment would I guess be more difficult, but maybe that could be a next step after covering the main functions of Cita? |
I looked into this quickly, using Mocha, Should.js, and nyc. But because Cita is tightly integrated with Zotero, it's not really possible to import any of the files to test in isolation because they depend on Zotero or firefox components. I think we'd therefore have to do something like in Zotero itself, where they launch a debug version of Zotero and firefox and then run normal js tests. |
I got this to work for another project using a docker image, installing Zotero in it and then using XVFB as a virtual display so Zotero can run in the docker container. I think we could do something similar for Cita, but use NPM and Mocha/Jest/whichever to do the tests. |
No description provided.
The text was updated successfully, but these errors were encountered: