mercredi 27 novembre 2019

Start a mysql server for tests

I am currently developing an aws lambda function with serverless framework in node10. My lambda executes queries in an mysql rds database with mysql client (https://www.npmjs.com/package/mysql).

I am writing tests and I need to not mock database result. I would like the following flow:

  • Before test: start a mysql server, configure the client with correct host and port, create schema, tables, ...
  • During test: insert data and test queries
  • At the end of test: destroy database

This seems like a very standard use case to me but I can't find anything to simply start a server. All I find is client to connect and query db. Is this possible to do that with node ?

Many thanks!

Aucun commentaire:

Enregistrer un commentaire