Select to view content in your preferred language

Experience Builder 1.6 Unit Tests

1862
6
Jump to solution
10-28-2021 08:50 AM
erniewise
Emerging Contributor

I downloaded version 1.6 and my unit tests started failing. I even tried running the unit tests that came with the sample widget and they failed. I think there is an issue with jimu-for-test that comes with 1.6. It is not able to find the withTheme that comes with jimu-theme. Is everyone else having the same issue and not able to run unit test that came with the sample widget?

1 Solution

Accepted Solutions
PeterJäderkvist
New Contributor

I had a second look at this and found some lines missing in jest.config.js for 1.6:

A moduleNameMapper is missing for jimu-theme:

 

"^jimu-theme$": "<rootDir>/dist/jimu-theme/index.js",

 

 

Also a testEnvironment must be set, just add the following line somewhere in the globals object of jest.config.js:

 

testEnvironment: "jsdom"

 

The test should now work again, at least for the sample widget.

View solution in original post

0 Kudos
6 Replies
GavinRehkemper
Esri Contributor

Thank you for your question @erniewise. I am also having that issue with the unit tests in the Simple widget. We're looking into this and will get back soon.

erniewise
Emerging Contributor

thanks @GavinRehkemper 

PeterJäderkvist
New Contributor

Same here. I have had issues with jimu-ui when testing some of my custom widgets also in 1.5. About a month ago I opened this issue about it:

Some jimu-ui components breaks testing · Issue #102 · Esri/arcgis-experience-builder-sdk-resources (...

0 Kudos
PeterJäderkvist
New Contributor

I had a second look at this and found some lines missing in jest.config.js for 1.6:

A moduleNameMapper is missing for jimu-theme:

 

"^jimu-theme$": "<rootDir>/dist/jimu-theme/index.js",

 

 

Also a testEnvironment must be set, just add the following line somewhere in the globals object of jest.config.js:

 

testEnvironment: "jsdom"

 

The test should now work again, at least for the sample widget.

0 Kudos
erniewise
Emerging Contributor

thanks that allows me to run my tests.

0 Kudos
GavinRehkemper
Esri Contributor