Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Svelte with Test-Driven Development
  • Table Of Contents Toc
Svelte with Test-Driven Development

Svelte with Test-Driven Development

By : Daniel Irvine
4.9 (10)
close
close
Svelte with Test-Driven Development

Svelte with Test-Driven Development

4.9 (10)
By: Daniel Irvine

Overview of this book

Svelte is a popular front-end framework used for its focus on performance and user-friendliness, and test-driven development (TDD) is a powerful approach that helps in creating automated tests before writing code. By combining them, you can create efficient, maintainable code for modern applications. Svelte with Test-Driven Development will help you learn effective automated testing practices to build and maintain Svelte applications. In the first part of the book, you’ll find a guided walkthrough on building a SvelteKit application using the TDD workflow. You’ll uncover the main concepts for writing effective unit test cases and practical advice for developing solid, maintainable test suites that can speed up application development while remaining effective as the application evolves. In the next part of the book, you’ll focus on refactoring and advanced test techniques, such as using component mocks and writing BDD-style tests with the Cucumber.js framework. In the final part of the book, you’ll explore how to test complex application and framework features, including authentication, Svelte stores, and service workers. By the end of this book, you’ll be well-equipped to build test-driven Svelte applications by employing theoretical and practical knowledge.
Table of Contents (22 chapters)
close
close
1
Part 1: Learning the TDD Cycle
8
Part 2: Refactoring Tests and Application Code
16
Part 3: Testing SvelteKit Features

Preface

What excites me about Svelte? Its simplicity, elegance, and pragmatic design ethos. Its growing success in the marketplace suggests that other programmers feel the same way too. I’m not surprised by this. When we write software for the JavaScript ecosystem, we have a choice: we can either accept and be consumed by the complexity of its primary constituents (React, Node.js, webpack, Babel, and so on) or we can actively seek out the marginalized products and processes that aim to simplify our work.

It’ll be no surprise to you that I place Test-Driven Development (TDD) firmly in this second camp. Because without it, what you have is a development workflow that largely consists of chasing bugs and carrying a lot of context in your head. This is always what I think of as the bad old days.

When I first started programming as a youngster, I remember the infuriating experience of debugging – writing some code, trying it out, finding bugs, and struggling for hours to figure out where the errors were hidden in my code. It seemed like a natural part of programming: devoting a large portion of my time to debugging. And this carried through into my first job as a C++ desktop application developer. (It wasn’t long before I discovered TDD and how it could help me have a simpler, quieter, calmer life.)

Then there’s the mental context you need when you plan out a grand design for the next feature you’re about to implement. You have to know where you’re at, what you’ve done, and what’s next, and do your best to not stray from the path. That’s hard when you’re being derailed by debugging and other distractions.

Sure, you can write a to-do list or keep a diary, but why not write some automated tests instead? They not only remind you where you’re at but they check for bugs, too.

That is essentially the idea behind TDD.

And if you like Svelte because it simplifies your life and makes you feel like you’re swimming rather than wading through mud, I think you’ll also like TDD. This book shows you the how and why of Svelte with TDD. I hope you enjoy it. Thanks for reading!

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Svelte with Test-Driven Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon