We are trying to implement unit tests and tried Jest which works beautifully. The problem started when we introduced a unit test which relied on a custom module build in npm. This module exports the code in two packages: commonjs and AMD. When we use the unit test with the commonjs module, then Jest works and the unit tests passes. If however we switch and want to use the AMD module, then Jest complains that “define is not defined”.
After spending some time on Google it seems like Jest does not support AMD (requirejs). There is an open ticket to support it but it is 4 years old. Ideally we would like to do unit tests with AMD modules as the application runs in a browser.
We also tried to get Karma working but has struggled to get it to see all the sources and 3rd party libraries.
Is there any other unit testing frameworks which support AMD (requirejs) or any other recommendations with regards to a unit testing framework?
These unit tests are not UI component specific and are more focused on business logic within the browser.
Any help appreciated