vitest-considered-harmful

Vitest Considered Harmful

(AKA Overloading Node Considered Harmful)

A repo for resources of the talk.

[!IMPORTANT] I’m currently working at Constantinople and we’re hiring!

We’re an all-in-one software and operational platform for banks!

If you can solve the issues seen in this talk, or you’re interested in working with us, get in touch at [email protected].

Evan Kohilas

nohumanerrors.com

Conference Slides Video Notes Length Year
SydJS 🔗 🔗 🔗 45 min 2024

Abstract

TODO

Outline

Overview

1-payments-with-integration-test

Mocking the Payment Service

2-service-mock

Adding new Payment Service method

3-service-new-method

Workaround using vi.hoisted

4-hoisted-mock

Workaround using vi.mocked

5-service-mocked

Namespacing the Payment Service

6-service-namespaced

Spying on the Payment Service

7-service-spied

Testing the Payment Service

8-service-test

Isolating tests

9-spy-reset

Spies and side effects

10-spy-side-effect

Adding feature flags as a new dependency

11-feature-flag-use

Testing with feature flags using spies

12-feature-flag-spy

Refactoring to use classes

13-class-refactor

Using mocked objects

14-mockito-injection

Conclusion

App

An example serverless app created with SST.

Getting Started

npm install

Commands

npm test

Runs the tests

npm run dev

Starts the Live Lambda Development environment.

npm run build

Build your app and synthesize your stacks.

npm run deploy [stack]

Deploy all your stacks to AWS. Or optionally deploy, a specific stack.

npm run remove [stack]

Remove all your stacks and all of their resources from AWS. Or optionally removes, a specific stack.

Documentation

Learn more about the SST.