0

I work on a vue.js app, which is tested with jest. To debug those tests I used this command node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js and everything worked fine in chrome dev tools.

Later we introduced some environmental variables to the project to set some values using dotenv (variables can be accessed through process.env), tests also run fine, but when the debugger is attached, environmental variable values are not read from .env file.

How to run/debug jest tests in chrome dev tools on a vue.js project that uses environmental variables described in .env file, accessed through process.env?

skyboyer
  • 22,209
  • 7
  • 57
  • 64
Adomas
  • 466
  • 1
  • 8
  • 21

1 Answers1

0

Exporting .env file contents helped. Ran such command export $((cat .env ; cat .test.env)| grep -v "^#" | xargs) && node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js, the exported .env variables got saved and on later runs it was enough to run just the test launching script node --inspect-brk node_modules/.bin/jest --runInBand --config test/jest.config.js

Adomas
  • 466
  • 1
  • 8
  • 21