Giter VIP home page Giter VIP logo

Comments (15)

Amoroth avatar Amoroth commented on May 21, 2024 3

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.

from hoppscotch.

Amoroth avatar Amoroth commented on May 21, 2024 1

@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.

from hoppscotch.

yubathom avatar yubathom commented on May 21, 2024 1

Right. I'll do a PR with cypress then.

from hoppscotch.

liyasthomas avatar liyasthomas commented on May 21, 2024 1

I think now its the time for next version release 🚀

Remaining v1.0 milestone tasks:

  • #93 Import request from cURL
  • #62 Fast URL entry
  • #33 Code highlight on response body : PR #76
  • #29 Ability to store/share/create collections : #72 Enable shareable requests with parameters in url queries
  • #2 #128 CORS

from hoppscotch.

yubathom avatar yubathom commented on May 21, 2024 1

@liyasthomas the setup is almost done. I will send a PR tomorrow.

from hoppscotch.

NBTX avatar NBTX commented on May 21, 2024

Agreed, we definitely need some proper unit tests. Nuxt seems to prefer Ava for testing.
https://nuxtjs.org/examples/testing

from hoppscotch.

Amoroth avatar Amoroth commented on May 21, 2024

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.

from hoppscotch.

liyasthomas avatar liyasthomas commented on May 21, 2024

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.

from hoppscotch.

NBTX avatar NBTX commented on May 21, 2024

@Amoroth Have you checked the code/scripts that create-nuxt-app runs 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.

from hoppscotch.

yubathom avatar yubathom commented on May 21, 2024

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.

from hoppscotch.

liyasthomas avatar liyasthomas commented on May 21, 2024

@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.

from hoppscotch.

NBTX avatar NBTX commented on May 21, 2024

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.

from hoppscotch.

Amoroth avatar Amoroth commented on May 21, 2024

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.

from hoppscotch.

liyasthomas avatar liyasthomas commented on May 21, 2024

@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!!

from hoppscotch.

liyasthomas avatar liyasthomas commented on May 21, 2024

#181 resolves this hence closing.

from hoppscotch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.