This is probably a process question. My test coverage in dev is solid but I've been trying to figure out how/what to do to integration test a web-app, service, or hopefully even package that's been deployed to a new environment. Hopefully reusing a lot (or all?) of the dev tests.
This would be to make sure the database/service/firewall/permissions that the app and server are using are setup correctly, reusing tests that we have to run in dev anyway so it wouldn't add more work.
I was thinking maybe shipping a sub-directory with apps/packages that has its own package.json, node_modules (including mocha chai etc), and the test-db.test.js files for mocha to run from the command line on the qa/prod server? Then those mocha tests would connect to the deployed js files, using those apps credentials to run all the tests against the DB?
Then logging into the server, or maybe even integrating those tests into the deployment script, ex after "npm ci; pm2 reload" for a web app, it'd run "mocha [app_dir]/int_tests/run_tests.test.js" from the prod server.
Feels like that might work, but I've never done this before and I'm making it up as I go. Any help or guidance from someone who's done this before or sees holes in this plan would be greatly appreciated! Thanks!