Testing with Jest

Testing your React Components/JS packages/NodeJS Apps/React Apps with Cantara works by simply executing the test command.

ctra test <name> [jestParameters...]

All files ending in .test.ts or .test.tsx (React) will be executed. For testing React Components, the awesome React Testing Library is used.

Just have a look in the packages/random-image-widget/src folder for an example.

If you for example want to run tests for the random-image-widget component, simply execute:

ctra test random-image-widget

At the end of the test command, you can append any Jest CLI option, e.g. --watch:

ctra test random-image-widget --watch