Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest does not work with Resium #105

Closed
delenius opened this issue Jul 24, 2019 · 5 comments
Closed

jest does not work with Resium #105

delenius opened this issue Jul 24, 2019 · 5 comments
Labels

Comments

@delenius
Copy link

delenius commented Jul 24, 2019

I set up resium using the craco approach.
Invoking jest causes ReferenceError: requirejsVars is not defined, as discussed here.
The solution described there does not work with CRA because there is no way to pass a CLI option to jest(?).
Could this be taken care of automatically by craco-cesium?

@rot1024
Copy link
Member

rot1024 commented Jul 25, 2019

craco-cesium does not support test for components using Resium and Cesium, because Cesium depends on require.js (AMD) and web APIs (WebGL, WebWorker, ...). If you want, you have to mock Cesium in Jest, but it seems to be hard.

related: #34

@delenius
Copy link
Author

@rot1024 , I know that's the problem... We need a solution ;) It is also not easy to switch to another test framework, given how CRA is structured. I guess the only solution is to eject and then use something other than jest?

@rot1024
Copy link
Member

rot1024 commented Jul 26, 2019

Hmm... You may need to do one of the following:

  1. Give up testing of components that uses Resium and Cesium. Components without Resium and Cesium are still testable.
  2. Eject the CRA project and start using other test runner that can run tests on the web browsers, for example, Karma.
  3. Write mocks of Cesium objects (components that uses Resium are testable if Cesium objects are correctly mocked)

@delenius
Copy link
Author

I need to test with real Cesium outputs, to sanity check my coordinate transformations and whatnot, so I guess (2) it is...

@rot1024
Copy link
Member

rot1024 commented Jul 29, 2019

Yes... I can not take care of the karma installation method, so please let me know if you can.

@rot1024 rot1024 closed this as completed Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants