Chapter 3.4.5: Cypress and Vitest Driver Setup
Learn how to update the configuration of Cypress and Vitest to make them run tests using our uniform Driver.
Disclaimer: You are reading an early version of the text! The final version of the book will be revised and may contain additional content.
Cypress Driver Setup
Let's start with updating our existing Cypress setup to make it play nicely with our newly created Driver. In our Tests, we import the it()
method from a virtual module @PROJECT_NAME/application-test-driver
. PROJECT_NAME
is a placeholder for our actual project name, so in our case, @shopping-list/application-test-driver
.
import { it } from '@shopping-list/application-test-driver';
// ...
it(`should list active items`, ({ driver }) => [
// ...
]);
But the @shopping-list/application-test-driver
module does not exist—neither in our node_modules
nor the source code of our application. So to make the code above work, we need to tell the Cypress bundler (by default, this is webpack) how to resolve the virtual Driver module. That way, we can make Cypress load our Cypress driver and, later, Vitest load the Vitest Driver.
Keep reading with a 7-day free trial
Subscribe to Good Tests for Vue Applications to keep reading this post and get 7 days of free access to the full post archives.