Nuxt 3 + Pinia + Tailwind TDD Todo App with Vitest (Part 1)

Поділитися
Вставка
  • Опубліковано 31 гру 2024

КОМЕНТАРІ • 55

  • @KaizenCodes
    @KaizenCodes  2 роки тому +9

    Finished code is on Github at: github.com/Eckhardt-D/nuxt3-todo and you can check it deployed live at nuxt3-todo.vercel.app

  • @businessoftechnology
    @businessoftechnology 6 місяців тому

    One of the best resources on Nuxt & testing out there. I am over half way through video one and am very curious if we are going to get to TDD or not at this point. So far the topic has been DDT, or development driven testing. It is so easy to create tests that align with our implementation rather than having our goals packaged in tests, and then generate the code that matches our goals because we have tests to validate that objective.

    • @KaizenCodes
      @KaizenCodes  5 місяців тому

      You’re right. Not true TDD. Thanks for pointing it out - I should have been more accurate

  • @PaulKEgellJohnsen
    @PaulKEgellJohnsen 2 роки тому +9

    Thank you for this, I learned a lot.
    I’d love to see you add tests where you use an API/db for storage as well.

    • @KaizenCodes
      @KaizenCodes  2 роки тому +5

      I don’t think I’ll be doing that for this project, but I will jot it down for an upcoming video. But essentially for database stuff I would include a validation library like Zod or Joi and write classes for the models with a lot more unit tests to see that the incoming data is correct and expect errors to be thrown if not. I would also mock the database calls in unit tests but in integration tests do the actual calls and clean up after each test. Thanks for the suggestion!

  • @LuckyStilet1
    @LuckyStilet1 2 роки тому +2

    Can't wait next part. Would be awesome to see deep components nesting (for what ever reason, just for testing practice) with multiple interconnections

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      The repo is on Github with the finished code for the next video (recording already, hopefully releasing by Saturday!). You can check out the components usage there. There's so much to cover for the next video I am wondering if I shouldn't make more than 2 parts. Otherwise I may rush over things like building out the UI. What do you think?

  • @alejandro.rodarte
    @alejandro.rodarte Рік тому

    Awesome content. Just finished Part 1. Tomorrow will continue with Part 2.

  • @ilyabitru
    @ilyabitru 2 роки тому +1

    Great tutorial! Learned allot. but could you explain 18:13 nitro externals. where I can read more in docks

  • @NeilMerton
    @NeilMerton 2 роки тому

    Thanks for this, I've learnt lots, and enjoy your teaching style.

  • @chunkycheese73
    @chunkycheese73 Рік тому

    Thanks for the tutorial when following along, I'm getting an error on the line "this.items.push(todo);"
    error is "Property 'items' does not exist on type '{ add(partialTodo: TodoAdd)

  • @arturtavares6487
    @arturtavares6487 2 роки тому

    Hey dude, what an amazing video! Learned a lot about testing! Thanks 😁

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      Hey Artur! Thanks man, I was just as blown away when I prototyped before the video. The tech really just makes it too easy. Props to THOSE devs 💪 glad it helped though!

  • @review.masahiro
    @review.masahiro 2 роки тому

    thank you for your tutorial. But I still face the error of getActive pinia on production env. can you have me to make one about this.

    • @KaizenCodes
      @KaizenCodes  2 роки тому

      Sorry, but I cannot help if I don't have context / able to reproduce your error. A repo may help?

  • @reeeeeeee8392
    @reeeeeeee8392 2 роки тому

    This was a really informative and useful video on TDD alone.

  • @cotneit
    @cotneit 2 роки тому +1

    10:40 - that empty array is still a Todo array

  • @victorwillian2177
    @victorwillian2177 2 роки тому

    awesome video, I was looking for one like this for a while... by the way what is your theme?

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      Thanks, glad it was decent :D And the theme I use is 'Apollo Midnight' with the 'JetBrains Mono' font ✨

    • @victorwillian2177
      @victorwillian2177 2 роки тому

      @@KaizenCodes thank you! I'm watching part 2 hahaha

  • @shehiali9889
    @shehiali9889 2 роки тому

    Great content, awaiting part 2. thanks

  • @gbruins
    @gbruins 2 роки тому

    This was great. Learned a lot

  • @chizuru1999
    @chizuru1999 2 роки тому

    I think one test case would fail where findIndex returns -1 maybe? which doesn't exist in the items array.
    Although we are gonna pass the id, in case anyone calls the update store method directly then it would be an issue.

    • @KaizenCodes
      @KaizenCodes  2 роки тому

      Good call! I'm the worst test writer 🤣🤣

    • @chizuru1999
      @chizuru1999 2 роки тому

      @@KaizenCodes No worries I am totally new to unit testing and Vue in general. But I have a strong background in AngularJS. Vue is just modern Angularjs for me xD.

  • @thejurex87
    @thejurex87 2 роки тому

    Thank you for the tutorial, it's great! Will be there a part 2? :)

  • @chirkov
    @chirkov 2 роки тому

    Why you add uuid in nitro?
    Sorry, I don't understand and translate

  • @omoyajowotemidayo5382
    @omoyajowotemidayo5382 2 роки тому

    Thanks for this amazing video.... Do you have any resources for getting started on testing in vuejs?

  • @PlikK129
    @PlikK129 2 роки тому

    Hello Kaizen, I'm having problems with vitest and vue/test-utils i want to test a simple component using vue/test-utils but vitest show an error "useRuntimeConfig is not defined", do you know how can I set autoimports of nuxt 3 with vitest? thanks bro

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      Hello! Ah yes I've had this issue too. It's quite annoying with autoImports :/ The only workaround I had so far was to create a .js file and do e.g. global.useRuntimeConfig = () => ... (basically mock it) and put it in Vitests globalSetup option array... it's quite dirty though and have enquired with the Nuxt team on best practice here, but no suggestions. I guess we'll have to wait for www.npmjs.com/package/@nuxt/test-utils to become stable and finished..

    • @KaizenCodes
      @KaizenCodes  2 роки тому

      For some imports though you can be explicit in the component and do import xxx from '#imports'.. Then in vitest configuration you could use the 'resolve' setting, something like:
      {
      resolve: {
      "#imports": "./.nuxt/..."
      }
      }
      or something in that direction. (not tested).

    • @PlikK129
      @PlikK129 2 роки тому

      @@KaizenCodes Thanks for your answer Kaizen

  • @danillofidelgomes6822
    @danillofidelgomes6822 2 роки тому

    Nice tutorial! how do i fix the problem with auto-import? typescript showing error on "ref" auto-mport and relative paths. help me =x

    • @KaizenCodes
      @KaizenCodes  2 роки тому

      Hey Danillo, I made a bit of a blunder here early in Nuxt3. Since then I've found out that we should use `useState` instead of ref to define local state variables in the setup function. E.g.
      const newTodo = useState('newTodo', () => '');
      Relative paths I think the best is just to use the `~~/your-src/file.ts`, where ~~ is the root of the project. Hope this helps. I'll be making a more in-depth Nuxt video again with better usage of conventionals.

    • @KaizenCodes
      @KaizenCodes  2 роки тому

      Also Nuxt3 has a CLI tool called nuxi, if you run `npx nuxi prepare` it will generate the necessary types and stuff for you.

  • @SaroJermin
    @SaroJermin 2 роки тому

    Do you know what your avatar means?

  • @jorgearley9321
    @jorgearley9321 Рік тому

    Hey Dude, thanks for a top-tier content. Please, consider to make a video about fetching data from some API and store with pinia in a nuxt 3 app as well, thanks in advance.

  •  2 роки тому

    How is useState Composable compared to Pinia?

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      useState is great! You can basically just create your own ‘store’ in the composables folder. I will explore this and make a video about the difference and use cases. Pinia adds a lot of cool functionality like hooking into changes and getting snapshots. But if an app is simple a simple useState will do just fine I think. This video is a very overthought todo app 😂 just to explore what’s possible. The next one is even more overengineered.

    •  2 роки тому

      Thank you very much for your reply. I'm looking forward to your videos in the future with Vue/Nuxt and cool features around its/their ecosystem.

    • @KaizenCodes
      @KaizenCodes  2 роки тому +2

      @ I have plenty planned out! Currently just busy with git add && git commit -m “feat: adds wife to Kaizen class” 😂 so after the honeymoon I’ll start releasing :) look forward to your comments and questions.

    •  2 роки тому

      Oh wow, Congratulations!

  • @mamlzy
    @mamlzy 2 роки тому

    Please add the part 2! thanks...

  • @hubertmisonia3604
    @hubertmisonia3604 2 роки тому +2

    How about part 2 ??

    • @KaizenCodes
      @KaizenCodes  2 роки тому +4

      It’s coming! See the latest community post on my channel. Adding a database with tests, user authentication and more! I’m not 100% sure about a release date, but if you want to you can subscribe not to miss it ☺️

    • @hubertmisonia3604
      @hubertmisonia3604 2 роки тому

      @@KaizenCodes OK .
      Thanks for the quality content.
      🙏🏾

  • @heyyy4987
    @heyyy4987 2 роки тому

    nuxt 3 ..more series please..

  • @bppdc
    @bppdc 2 роки тому

    Great video, thank you

  • @henryhoang688
    @henryhoang688 2 роки тому

    Nuxt 3 + firebase please

  • @TheWLNS
    @TheWLNS 2 роки тому

    nice video thanks

  • @yevheniimoskalenko1624
    @yevheniimoskalenko1624 2 роки тому

    cool)

  • @LuckyStilet1
    @LuckyStilet1 2 роки тому

    why expect(store.items).toStrictEqual([]) is true ?
    as [] === [] // false

    • @KaizenCodes
      @KaizenCodes  2 роки тому +1

      The assertion library does a bit more than '===', you can read more about it here vitest.dev/api/#tostrictequal

  • @mehmetaltinsoy525
    @mehmetaltinsoy525 2 роки тому

    Great video. Thanks.