Accessing assets from webJars from unit test

Enonic version: 7.1.1
OS: MacOs

I’m trying to write some unit-tests using the xp/testing framework. But some of the code which I need to test depend on assets fetched from webJars. In my case momentjs. The controllers run just fine and uses the normal requires, but when trying to do load the same code from the test it crashes with an Resource not found exception.

com.enonic.xp.resource.ResourceProblemException: Resource [myapplication:/assets/momentjs/2.24.0/min/moment-with-locales.js] was not found

    Caused by:
    com.enonic.xp.resource.ResourceNotFoundException: Resource [myapplication:/assets/momentjs/2.24.0/min/moment-with-locales.js] was not found

Anyone run in to a similar problem?

Thanks,

Tom

3 Likes