Skip to main content

Testing

Medplum strongly believes in the importance of testing.

We use the following tools for testing:

Every pull request is analyzed by Sonarcloud and Coveralls for code coverage and other static analysis.

How to test

To run all tests for all packages, use the build script:

npm t

To run all tests for a single package, use npm t inside the package folder:

cd packages/app
npm t

To run tests for a single file, pass in the file name:

npm t -- src/App.test.tsx

To run a single test in a single file, pass the file name and the test name:

npm t -- src/App.test.tsx -t 'Click logo'

Any time you run npm t, you can optionally pass in --coverage to collect code coverage stats. They will be printed in the terminal:

npm t -- --coverage
npm t -- src/App.test.tsx --coverage
npm t -- src/App.test.tsx -t 'Click logo' --coverage