I am working on client-only app, which is implemented as an html page with the "backend" (engine of the application) written in javascript, and UI implemented in React+typescript.
The solution two main folders are 'src' and 'public'. Folder 'src' contains typescript sources, files from src folder are compiled (transpiled) + minimized/obfuscated. Folder 'public' contains index.html file and 'backend' js files. JS files don't get compiled due to specific eval-dependent implementation of the backend.
UI part of the application (ts) depends on the backend (js). JS classes are available for use in runtime.
The problem I have faced is problem with creating "integration" tests using jest: I cannot load my js files before tests execution.
I tried to tune jest configuration to include the needed js files, but didn't succeed.
"jest": { "setupFilesAfterEnv": ["/public/engine.js"] }
During runtime of tests I get errors about missing class definitions (the ones which should come from js file).
How can I solve this problem?