Basic Setup
Setup your environment
Setup the project
In this tutorial, you'll need to have Node.js installed.
We will start from an already bootstrapped project to focus on our target: writing our first test.
Setup
You may want to refer to our Getting Started section to setup fast-check in an existing project or without tutorial related code.
- npm
- Yarn
- pnpm
npx degit dubzzz/fast-check/website/templates/fast-check-tutorial fast-check-tutorial
cd fast-check-tutorial
npm i
yarn dlx degit dubzzz/fast-check/website/templates/fast-check-tutorial fast-check-tutorial
cd fast-check-tutorial
npm i
pnpm dlx degit dubzzz/fast-check/website/templates/fast-check-tutorial fast-check-tutorial
cd fast-check-tutorial
npm i
Project structure
Our tutorial project is rather small, it contains the following files:
package.json
— the dependencies, scripts… used by the projectsort.mjs
— the code we want to testsort.test.mjs
— our test file
This project is relying on Vitest to run the tests.
Test runners
Run the tests
You can run the tests written in the test file with:
- npm
- Yarn
- pnpm
npm test
yarn test
pnpm test
We are now ready to start!