License activation fails in jasmine unit tests

1 Answer 275 Views
General Discussions Licensing
Megan
Top achievements
Rank 1
Iron
Iron
Megan asked on 12 Oct 2022, 04:12 PM

My license activates as expected when running the app normally, but I get a warning when unit testing.

In a component which uses the MultiSelect, I have to import the DropDownsModule for the component's spec.ts file. However, once I do so, I get warnings that the license activation failed and no license was found.

What's causing this and what do I need to provide the tests with?

1 Answer, 1 is accepted

Sort by
0
Siyka Marinova
Telerik team
answered on 17 Oct 2022, 01:19 PM

Hello Megan,

If tests are run as part of a CI build, the license key must be present at build time. The recommended approach in this case is to use an environment variable. Each platform has a different process for setting environment variables. Some of the most popular examples are explained in our Adding the License Key to CI Services article.

Another thing you may try is to clear the cache, stored by Angular, by running the following command:

rm -rf .angular/cache
After that, follow again the steps described in the Installing and Updating License Keys article. For more information, please refer to the Angular Persistent disk cache article.

Please, let me know if you need further assistance with this issue.

Regards,
Siyka Marinova
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Megan
Top achievements
Rank 1
Iron
Iron
commented on 07 Nov 2022, 03:32 PM

While it will be part of a CI build later, this is just my own local environment. I even tried adding the license as an environment variable, and my unit tests are still warning that the license activation failed.
Yanmario
Telerik team
commented on 10 Nov 2022, 01:40 PM

Hi Megan,

I will consult with our development team about this matter and will get back to you as soon as I get an update. In the meantime, the warning itself won't cause any issues with the tests and should be ignored.

Regards,
Yanmario
Progress Telerik     

Yanmario
Telerik team
commented on 14 Nov 2022, 02:49 PM

Hi Megan,

It seems that the license warning when testing is present in node v14 and npm 6. Updating to node v16 and npm v8 seems to fix that. The license warning is no longer present when running `ng test`. For the time being, I would recommend using both mentioned versions and our team will also investigate why the warning is present in older versions of node and npm. 

Precise versions that were used for testing are node v16.13.2 and npm v8.1.2.

Storing the key in a global environment called KENDO_UI_LICENSE might work in older versions.

Regards,
Yanmario
Progress Telerik     

Tags
General Discussions Licensing
Asked by
Megan
Top achievements
Rank 1
Iron
Iron
Answers by
Siyka Marinova
Telerik team
Share this question
or