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

Unit tests #524

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

doug-newman-nasa
Copy link

@doug-newman-nasa doug-newman-nasa commented Jan 8, 2025

fixes #522
I've added the following in support of a unit test suite for STACBrowser:

  1. Jest unit testing framework to package.json
  2. Jest run script and coverage commands so that each 'npm test' will report and record code coverage with a desired goal of 80%
  3. Provided an example unit test suite for Utils.js (the first two functions)
  4. Minor update to README to document unit testing and fix the npm install command in Contributing section

@m-mohr m-mohr changed the title 522 jest code coverage Unit tests Jan 8, 2025
@m-mohr
Copy link
Collaborator

m-mohr commented Feb 24, 2025

Thanks @doug-newman-nasa.

As STAC Browser is primarily a (Vue-based) user interface, jest-based tests can only do so much. We can test some parts of the JS util files and some of the models, but most code can't directly be tested with the tooling that is introduced here (i.e. Jest).

Looking at the bigger picture, we need to extend this to also be able to test Vue components and UI interactions in general. Otherwise, the tests will not be very useful.

So we probably also need to introduce something like

There are more options out there it seems, like cypress, NightwatchJS, Playwright, Selenium, etc.

I don't have a lot of experince in any of the tools yet, but I think we should first check how this all can work together and whether Jest is a good choice together with the other testing libraries that we choose to use for Component and UI tests. If any of the other libraries already cover what Jest does, we may not even need Jest. As such I'm a bit hesistant to just merge this PR without looking at the bigger picture. We generally just need to ensure we make a good choice here as STAC Browser is quite a complex tool that will ultimately need a lot of tests, so making a bad choice here may waste a lot of time, which we don't have in open source ;-)

I don't have time to investigate the other parts yet, but hopefully have some time over Summer. If there's anyone who could help and has experience (or has time to gain experienence) and propose a solution, I'm happy to collaborate.

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

Successfully merging this pull request may close these issues.

Add a unit test suite
2 participants