NodeJS – Run tests and hot reload

I am trying to simulate a production-esque pipeline. I would like to run unit tests when my project changes, and then I would like to hot reload the existing solution, only if it succeeds. This is akin to what we do in production, but on a compressed timescale.

I can run app, I can hot reload it. I can run my tests, I cam hot reload them.

I have read up on grunt and gulp but haven’t seen anything comparable.

Right now the best plan I have is for my pipeline code to copy my existing app to another folder and run that with hot-reload. I would then watch the project for changes. On chamge I would run tests and wait for a successful exit code. If I get a success, I would copy my project files over my running app and it should hot-reload.

I usually code in C# but opted to use JS as it’s a bit more immediate.

Is there something simple I am missing or do I need to write a complex custom pipeline to accomplish this?

Thanks in advance