Guest User

Jest GLTFLoader

a guest
Mar 17th, 2023
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. src/components/__test__/body.test.js
  2. ● Test suite failed to run
  3.  
  4. Jest encountered an unexpected token
  5.  
  6. Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
  7.  
  8. Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
  9.  
  10. By default "node_modules" folder is ignored by transformers.
  11.  
  12. Here's what you can do:
  13. • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
  14. • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
  15. • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
  16. • If you need a custom transformation specify a "transform" option in your config.
  17. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
  18.  
  19. You'll find more details and examples of these config options in the docs:
  20. https://jestjs.io/docs/configuration
  21. For information about custom transformations, see:
  22. https://jestjs.io/docs/code-transformation
  23.  
  24. Details:
  25.  
  26. /Users/Ben/Desktop/greening_the_spark_frontend/node_modules/three/examples/jsm/loaders/GLTFLoader.js:1
  27. ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import {
  28. ^^^^^^
  29.  
  30. SyntaxError: Cannot use import statement outside a module
  31.  
  32. 4 | import { Canvas, useFrame } from "@react-three/fiber";
  33. 5 | import { useLoader } from "@react-three/fiber";
  34. > 6 | import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
  35. | ^
  36. 7 |
  37.  
Advertisement
Add Comment
Please, Sign In to add comment