Vitest
, is possible in your project, we highly
recommend using it instead of tinybench
.Click here to see how to use the MongoDB instrument with Vitest.@codspeed/tinybench-plugin>=3.0.0
CodSpeedHQ/codspeed-nestjs-mongodb
repository.
It uses the following technologies:
Cat
model is defined:
CatsController
exposes the following endpoints:
@codspeed/tinybench-plugin
:
cats
endpoints of the
application.
cats
endpoints:
GET /cats
: retrieve all the catsGET /cats/name/:name
: retrieve all the cats with the given nameGET /cats/breed/:breed
: retrieve all the cats with the given breedGET /cats/age/greater/:age
: retrieve all the cats with an age greater than
the given agesrc/bench.e2e.ts
file:
tinybench
, we recommend using ts-node
with swc
:
swc
when running ts-node
, add the following to your
tsconfig.json
:
package.json
:
testcontainers
to start a
MongoDB instance dynamically during the benchmarks.
For this setup, we assume that the state of the application is similar to the
one described in the above section.
testcontainers
dependencies:
src/bench.e2e.ts
file to the following:
colima
to
run Docker containers. However there are
issues using testcontainers
on macOS.To bypass those issues, some environment variables need to be set when running
the tests:Enforce a check that the correct environment variables are set
testcontainers
work on macOS with colima
, the following environment variables need to be set:tinybench
. Add the following function to your src/bench.e2e.ts
file:setupDatabase
function:codspeed.yml
file to the following:
mongodb-cluster-action
stepmongo-uri-env-name
inputMONGO_URI
environment variable