How to update an existing project in your Nx workspace to use Jest as a test runner instead of Karma

Nx v6.3 introduced the ability to use Jest as a unit test runner. When you generate a new library or application in your Nx workspace, Nx conveniently asks you whether you want to use Jest or Karma as a unit test runner. But what if you have an existing library that was previously configured to use Karma? How can you update your existing library to use Jest instead of Karma?