mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #65] Add Tests #25
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Amoroth on GitHub (Aug 26, 2019).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/65
Originally assigned to: @Amoroth on GitHub.
Is your feature request related to a problem? Please describe.
I just found the project and I think it's great, but suddenly it stopped working. I noticed that a few minuter ago a pull request was merged, so I think that, it may have something to do with it. It says in console: "TypeError: Cannot read property 'className' of undefined".
Describe the solution you'd like
I noticed that the project lacks tests, maybe it would be better to add them to avoid mistakes in the future?
Describe alternatives you've considered
None.
Additional context
None.
@NBTX commented on GitHub (Aug 26, 2019):
Agreed, we definitely need some proper unit tests. Nuxt seems to prefer Ava for testing.
https://nuxtjs.org/examples/testing
@Amoroth commented on GitHub (Aug 26, 2019):
Makes sense, Ava seems to be fast with async tests but they use it only for e2e testing, I don't know if it can be used for unit tests. We could also use Jest which is officialy supported by vue but seems to be a bit harder to setup with Nuxt. But if we don't need unit tests, then Ava seems to me like a good choice.
@liyasthomas commented on GitHub (Aug 26, 2019):
We we need these badly. I think Jest can also be integrated with Nuxt with a catch (https://stackoverflow.com/questions/52493255/integration-testing-with-nuxt-and-jest) but AVA seems to have out of the box support to Nuxt for E2E and unit testing.
@Amoroth commented on GitHub (Aug 26, 2019):
So I've played around with testing in Ava and all the examples are made with e2e testing in mind, which involves setting up a server, and making requests to it. As it is all asynchrous, Ava seems to be doing a good job. I noticed aswell, that the project is set up as an spa, so a server should not be needed.
I also tried Jest, to see how it would work and integrating it into Nuxt is not that bad, it is simply used like in any normal Vue app. It only requires 3 packages, Jest itself, @vue/test-utils and vue-jest, but the last one has to be version 4.0.0-0 at least. It is supported by Nuxt itself, though there are no examples for that, in create-nuxt-app cli, there is an option to enable Jest or Ava as a testing framework.
Also, for unit tests, it would be best to use Vue Test Utils and according to this https://github.com/eddyerburgh/vue-unit-test-perf-comparison, there are performance considirations with Ava. It was made 2 years ago, so it might be fixed already, but when I was checking them, Jest seemed to be faster. There might be a problem with Jest though, that supposedly it doesn't trigger asyncData(). I haven't checked it myself, but apparently, it can be fixed by calling it manually.
@NBTX commented on GitHub (Aug 27, 2019):
@Amoroth Have you checked the code/scripts that
create-nuxt-appruns for setting up either test libraries? The Nuxt team is pretty 'on it' and it's possible they've patched these kinds of issues in their setup process.@Amoroth commented on GitHub (Aug 28, 2019):
@NBTX I did, I think both work well but Ava has a bit more dependencies and a setup file to actually be able to parse vue files. Jest just seems a bit simpler for me, I wrote a few tests already to check how it works with nuxt and so far, it is really simple. From what I have found, Ava seems to excel at async tests while Jest is great with running tests in parallel, which is great for ui testing.
@yubathom commented on GitHub (Aug 30, 2019):
I made a setup and created some e2e tests with cypress Im a personal dev purpose branch. If you're considering cypress I can do a PR with this setting.
@liyasthomas commented on GitHub (Aug 30, 2019):
@yubathom I personally haven't used Cypress before. But if it does the job we can consider using it. If anybody else is working on Ava or Jest they can continue that.
@NBTX commented on GitHub (Aug 30, 2019):
I'm not particularly familiar with any testing libraries in particular, so I don't really mind which we use. I just took a look at a unit test you linked and it looks fine to me.
TL;DR: I'm happy with Cypress.
@Amoroth commented on GitHub (Aug 30, 2019):
I don't know anything about Cypress but it looks like an e2e testing framework specifically. I don't think that is bad at all but doing unit tests in it may be harder as Vue Test Utils doesn't support it, it may work though, I don't know. Cypress, I think, works by spinning up whole local server and runs tests against it, while Jest works in isolated enviroments that just simulate real browsers. I didn't do any e2e tests yet, but I have worked on some unit tests already in Jest, you can look at how it looks like, setup and structure, here. Now, I would like to point out, that I am no professional and the test cases may be awful, but I guess it's a start.
@yubathom commented on GitHub (Aug 30, 2019):
Right. I'll do a PR with cypress then.
@liyasthomas commented on GitHub (Sep 6, 2019):
I think now its the time for next version release 🚀
Remaining v1.0 milestone tasks:
@liyasthomas commented on GitHub (Sep 15, 2019):
@Amoroth @yubathom is there any updates on this issue? I hope stable release v1.0 will be at the end of this week and it would be great to run some tests!!
@yubathom commented on GitHub (Sep 15, 2019):
@liyasthomas the setup is almost done. I will send a PR tomorrow.
@liyasthomas commented on GitHub (Oct 6, 2019):
#181 resolves this hence closing.