I have an app that depends on environmental variables like:
const APP_PORT = process.env.APP_PORT || 8080;
and I would like to test that for example:
- APP_PORT can be set by node env variable.
- or that an
express
app is running on the port set withprocess.env.APP_PORT
How can I achieve this with Jest? Can I set these process.env
variables before each test or should I mock it somehow maybe?
Aucun commentaire:
Enregistrer un commentaire