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

Runtime errors in unit tests files with the sufix .js that contain JSX #3802

Open
6 tasks
rmessina1010 opened this issue Feb 14, 2025 · 0 comments
Open
6 tasks

Comments

@rmessina1010
Copy link
Contributor

Description

Resolve .jsx parsing issue that is leading to runtime errors in unit tests files with the sufix .js that contain JSX elements.
Example:
Exception during run: SyntaxError[ @/Users/raymessina/Desktop/__store git/vets-website/src/platform/user/tests/authentication/components/SessionTimeoutModal.unit.spec.js ]: Unexpected token '<' at compileSourceTextModule (node:internal/modules/esm/utils:340:16) at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18) at ModuleLoader.#translate (node:internal/modules/esm/loader:433:12) at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27) at ModuleJob._link (node:internal/modules/esm/module_job:112:19)

Details

May also be related to this warning:
Warning: Module type of file:///Users/raymessina/Desktop/__store%20git/vets-website/src/platform/testing/unit/mocha-setup.js is not specified and it doesn't parse as CommonJS. Reparsing as ES module because module syntax was detected. This incurs a performance overhead. To eliminate this warning, add "type": "module" to /Users/raymessina/Desktop/__store git/vets-website/src/platform/testing/package.json.

Tasks

  • Check Mocha configurations
  • Check Babel configurations
  • What overhead would Webpack entail
  • If necessary swap suffixes for .jsx

Acceptance Criteria

  • should be able to run test directories with unit tests files with the sufix .js that contain JSX elements.
  • other tests and features should not be adversely affected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant