I am able to run the Angular application locally without any errors. However, when executing Jasmine/Karma unit tests locally, I intermittently encounter the following error:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at node_modules/@progress/kendo-licensing/dist/index.mjs:1:1826
at node_modules/@progress/kendo-licensing/dist/index.mjs:1:1834
at Array.map (<anonymous>)
at a (node_modules/@progress/kendo-licensing/dist/index.mjs:1:1740)
at N (node_modules/@progress/kendo-licensing/dist/index.mjs:1:20086)
at validatePackage (node_modules/@progress/kendo-licensing/dist/index.mjs:1:20917)
at new _ComboBoxComponent (
node_modules/@progress/kendo-angular-dropdowns/fesm2022/progress-kendo-angular-dropdowns.mjs:5603:9
)
at NodeInjectorFactory.factory (
node_modules/@progress/kendo-angular-dropdowns/fesm2022/progress-kendo-angular-dropdowns.mjs:6520:16
)
at getNodeInjectable (
http://localhost:9876/darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/di.ts:785:38
)At the same time, the following warnings appear in the test output:
WARN: 'No Telerik and Kendo UI License found. To download a license key file, visit https://prgress.co/3PwQMKZ'
Also, the error is not consistent. I am receiving same licensing error from kendo grid package.
Chrome Headless 146.0.0.0 (Windows 10) KendoGridComponent can load instance FAILED
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at node_modules/@progress/kendo-licensing/dist/index.mjs:1:1826
at map (node_modules/@progress/kendo-licensing/dist/index.mjs:1:1835)
at Array.map (<anonymous>)
at a (node_modules/@progress/kendo-licensing/dist/index.mjs:1:1740)
at N (node_modules/@progress/kendo-licensing/dist/index.mjs:1:8844)
at getLicenseMessage (node_modules/@progress/kendo-angular-common/fesm2022/progress-kendo-angular-common.mjs:1485:36)
at new GridComponent (node_modules/@progress/kendo-angular-grid/fesm2022/progress-kendo-angular-grid.mjs:33359:48)
at NodeInjectorFactory.factory (node_modules/@progress/kendo-angular-grid/fesm2022/progress-kendo-angular-grid.mjs:34710:16)
at getNodeInjectable (node_modules/@angular/core/fesm2022/_debug_node-chunk.mjs:1044:38)Environment Details
- Angular version: 21.2
- Kendo UI components: Version
23.3.0(full list below) - @progress/kendo-licensing:
^1.11.0
"@progress/kendo-angular-buttons": "^23.3.0", "@progress/kendo-angular-dateinputs": "^23.3.0", "@progress/kendo-angular-dialog": "^23.3.0", "@progress/kendo-angular-dropdowns": "^23.3.0", "@progress/kendo-angular-excel-export": "^23.3.0", "@progress/kendo-angular-grid": "^23.3.0", "@progress/kendo-angular-icons": "^23.3.0", "@progress/kendo-angular-indicators": "^23.3.0", "@progress/kendo-angular-inputs": "^23.3.0", "@progress/kendo-angular-intl": "^23.3.0", "@progress/kendo-angular-l10n": "^23.3.0", "@progress/kendo-angular-label": "^23.3.0", "@progress/kendo-angular-layout": "^23.3.0", "@progress/kendo-angular-menu": "^23.3.0", "@progress/kendo-angular-navigation": "^23.3.0", "@progress/kendo-angular-pager": "^23.3.0", "@progress/kendo-angular-pdf-export": "^23.3.0", "@progress/kendo-angular-popup": "^23.3.0", "@progress/kendo-angular-progressbar": "^23.3.0", "@progress/kendo-angular-toolbar": "^23.3.0", "@progress/kendo-angular-treeview": "^23.3.0", "@progress/kendo-angular-upload": "^23.3.0", "@progress/kendo-angular-utils": "^23.3.0", "@progress/kendo-data-query": "^1.7.4", "@progress/kendo-drawing": "^1.25.0", "@progress/kendo-svg-icons": "^4.8.0", "@progress/kendo-angular-common": "^23.3.0", "@progress/kendo-angular-conversational-ui": "^23.3.0",
What I’ve Tried
I followed the solutions suggested in the Telerik forum thread below, but the issue still occurs intermittently during unit test execution:
Question
Why does the Kendo licensing validation fail only during Jasmine unit tests, while the application runs normally, and how can this be reliably resolved or mocked for unit testing?